Skip to content

Commit fceb401

Browse files
Add dolfinx dependencies in user docker image as requirement and run end-user Docker image build in CI (#3697)
* Add required cmake flags for C++ Dolfinx dependencies * Add non publishing CI for end user Docker image * Switch to env variable * Other access pattern * Again * Move to steps
1 parent fd015ba commit fceb401

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

.github/workflows/docker-end-user.yml

+25
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ on:
1010
schedule:
1111
# '*' is a special character in YAML, so string must be quoted
1212
- cron: "0 1 * * *"
13+
push:
14+
branches:
15+
- "**"
16+
tags:
17+
- "v*"
18+
pull_request:
19+
branches:
20+
- main
21+
merge_group:
22+
branches:
23+
- main
1324
workflow_dispatch:
1425
inputs:
1526
tag_prefix:
@@ -54,6 +65,9 @@ on:
5465
type: string
5566
required: true
5667

68+
env:
69+
publish: ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
70+
5771
jobs:
5872
create_end_user_images:
5973
name: Build DOLFINx end-user images
@@ -100,18 +114,21 @@ jobs:
100114
repository: "FEniCS/basix"
101115
path: "basix"
102116
ref: ${{ env.BASIX_REF }}
117+
103118
- name: Checkout UFL
104119
uses: actions/checkout@v4
105120
with:
106121
repository: "FEniCS/ufl"
107122
path: "ufl"
108123
ref: ${{ env.UFL_REF }}
124+
109125
- name: Checkout FFCx
110126
uses: actions/checkout@v4
111127
with:
112128
repository: "FEniCS/ffcx"
113129
path: "ffcx"
114130
ref: ${{ env.FFCX_REF }}
131+
115132
- name: Checkout DOLFINx
116133
uses: actions/checkout@v4
117134
with:
@@ -122,6 +139,7 @@ jobs:
122139
- name: Set default FFCx options
123140
run: |
124141
echo '{ }' > dolfinx/docker/ffcx_options.json
142+
125143
- name: Set default DOLFINx JIT options
126144
run: |
127145
echo '{ "cffi_extra_compile_args" : ["-O2"] } ' > dolfinx/docker/dolfinx_jit_options.json
@@ -182,17 +200,21 @@ jobs:
182200
/bin/bash -c "source /usr/local/bin/dolfinx-complex-mode && python3 -c $'import dolfinx; from dolfinx.fem import functionspace; from dolfinx.mesh import create_unit_square; from mpi4py import MPI; mesh = create_unit_square(MPI.COMM_WORLD, 10, 10); V = functionspace(mesh, (\"Lagrange\", 1));'"
183201
184202
- name: Login to Docker Hub
203+
if: ${{ env.publish == 'true' }}
185204
uses: docker/login-action@v3
186205
with:
187206
username: ${{ secrets.DOCKERHUB_USERNAME }}
188207
password: ${{ secrets.DOCKERHUB_TOKEN }}
208+
189209
- name: Push to the DockerHub registry
210+
if: ${{ env.publish == 'true' }}
190211
run: |
191212
docker push docker.io/dolfinx/dolfinx-onbuild:${{ env.TAG }}
192213
docker push docker.io/dolfinx/dolfinx:${{ env.TAG }}
193214
docker push docker.io/dolfinx/lab:${{ env.TAG }}
194215
195216
- name: Cleanup
217+
if: ${{ env.publish == 'true' }}
196218
run: |
197219
docker rmi docker.io/dolfinx/lab:${{ env.TAG }}
198220
docker rmi docker.io/dolfinx/dolfinx:${{ env.TAG }}
@@ -212,19 +234,22 @@ jobs:
212234
echo "TAG=${USER_INPUT:-nightly}" >> $GITHUB_ENV
213235
214236
- name: Login to Docker Hub
237+
if: ${{ env.publish == 'true' }}
215238
uses: docker/login-action@v3
216239
with:
217240
username: ${{ secrets.DOCKERHUB_USERNAME }}
218241
password: ${{ secrets.DOCKERHUB_TOKEN }}
219242

220243
- name: Login to GitHub Container Registry
244+
if: ${{ env.publish == 'true' }}
221245
uses: docker/login-action@v3
222246
with:
223247
registry: ghcr.io
224248
username: ${{ github.repository_owner }}
225249
password: ${{ secrets.GITHUB_TOKEN }}
226250

227251
- name: Push multiarch images to ghcr.io and docker.io
252+
if: ${{ env.publish == 'true' }}
228253
run: |
229254
GH_PREFIX="ghcr.io/fenics/dolfinx"
230255
DH_PREFIX="docker.io/dolfinx"

docker/Dockerfile.end-user

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ ONBUILD RUN cd basix && cmake -G Ninja -DCMAKE_BUILD_TYPE=${DOLFINX_CMAKE_BUILD_
9191
ONBUILD RUN cd dolfinx && \
9292
mkdir -p build-real && \
9393
cd build-real && \
94-
PETSC_ARCH=linux-gnu-real64-32 cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local/dolfinx-real -DCMAKE_BUILD_TYPE=${DOLFINX_CMAKE_BUILD_TYPE} ../cpp && \
94+
PETSC_ARCH=linux-gnu-real64-32 cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr/local/dolfinx-real -DCMAKE_BUILD_TYPE=${DOLFINX_CMAKE_BUILD_TYPE} -D_REQUIRE_PETSC=ON -D_REQUIRE_SLEPC=ON -D_REQUIRE_SCOTCH=ON -D_REQUIRE_KAHIP=ON -D_REQUIRE_ADIOS2=ON ../cpp && \
9595
ninja install && \
9696
cd ../python && \
9797
PETSC_ARCH=linux-gnu-real64-32 pip -v install \

0 commit comments

Comments
 (0)