]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Refactor Docker workflow 18235/head
authorLuca Heltai <luca.heltai@unipi.it>
Wed, 12 Mar 2025 17:19:11 +0000 (18:19 +0100)
committerLuca Heltai <luca.heltai@unipi.it>
Fri, 14 Mar 2025 13:12:17 +0000 (14:12 +0100)
.github/workflows/docker.yml
contrib/docker/Dockerfile

index b172077b9bfe336808a5c66dd64cbbc8d3e41182..4174d6490744876918c32a0aef020085b350ab83 100644 (file)
@@ -3,48 +3,41 @@ name: github-docker
 on:
   push:
     branches:
-      - 'docker*'
+      - "docker*"
   schedule:
-  - cron: '0 */12 * * *'
+    - cron: "0 */12 * * *"
 
 permissions:
   contents: read
   packages: write
 
-env:
-  REGISTRY_IMAGE: dealii/dealii
-
 jobs:
   build-master-docker-ubuntu:
     # Build images for different ubuntu versions on different platforms
 
     if: (github.event_name == 'schedule' && github.repository == 'dealii/dealii') || github.event_name != 'schedule'
 
-    name: build master docker ${{ matrix.ubuntu_version }} ${{ matrix.platform }}
-    runs-on: ${{ matrix.os }}
+    name: build master docker ${{ matrix.ubuntu_version }} ${{ matrix.architecture }}
+    runs-on: ${{ matrix.runs-on }}
 
     strategy:
       fail-fast: false
       matrix:
         ubuntu_version: [jammy, noble]
-        platform: [amd64, arm64]
+        architecture: [amd64, arm64]
         include:
-          - platform: amd64
-            os: ubuntu-24.04
-          - platform: arm64
-            os: ubuntu-24.04-arm
+          - architecture: amd64
+            runs-on: ubuntu-24.04
+            flags: ""
+          - architecture: arm64
+            runs-on: ubuntu-24.04-arm
+            flags: -mno-outline-atomics
           # Use all available processors to build.
           # Specify the number of jobs explicitly since the default '0'
           # causes the github workers to disconnect (potential crash).
           - n_jobs: 4
 
     steps:
-      - name: Docker meta
-        id: meta
-        uses: docker/metadata-action@v5
-        with:
-          images: ${{ env.REGISTRY_IMAGE }}
-          
       - name: Checkout code
         uses: actions/checkout@v4
 
@@ -64,7 +57,7 @@ jobs:
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
 
-      - name: Build and push Docker image of master ${{ matrix.ubuntu_version }}-${{ matrix.platform }}
+      - name: Build and push Docker image of master ${{ matrix.ubuntu_version }}-${{ matrix.architecture }}
         id: build
         uses: docker/build-push-action@v6
         with:
@@ -75,25 +68,13 @@ jobs:
             IMG=${{ matrix.ubuntu_version }}
             NJOBS=${{ matrix.n_jobs }}
             VER=master
-          platforms: linux/${{ matrix.platform }}
-          labels: ${{ steps.meta.outputs.labels }}
-          push: ${{ github.event_name == 'schedule' }}
-          outputs: type=image,name=ghcr.io/${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
+            FLAGS=${{ matrix.flags }}
+          platforms: linux/${{ matrix.architecture }}
+          tags: |
+            ghcr.io/dealii/dealii:master-${{ matrix.ubuntu_version }}-${{ matrix.architecture }}
+            dealii/dealii:master-${{ matrix.ubuntu_version }}-${{ matrix.architecture }}
+          push: true
 
-      - name: Export digest
-        run: |
-          mkdir -p /tmp/digests
-          digest="${{ steps.build.outputs.digest }}"
-          touch "/tmp/digests/${digest#sha256:}"
-      
-      - name: Upload digest
-        uses: actions/upload-artifact@v4
-        with:
-          name: digests-${{ matrix.ubuntu_version }}-${{ matrix.platform }}
-          path: /tmp/digests/*
-          if-no-files-found: error
-          retention-days: 1
-  
   merge:
     # Merge all images for a specific ubuntu version
 
@@ -106,25 +87,17 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        ubuntu_version: [jammy, noble]
+        docker:
+          - ghcr.io/dealii/dealii
+          - dealii/dealii
+        ubuntu_version:
+          - jammy
+          - noble
 
     steps:
-      - name: Download digests
-        uses: actions/download-artifact@v4
-        with:
-          path: /tmp/digests
-          pattern: digests-${{ matrix.ubuntu_version }}-*
-          merge-multiple: true
-
       - name: Set up Docker Buildx
         uses: docker/setup-buildx-action@v3
 
-      - name: Docker meta
-        id: meta
-        uses: docker/metadata-action@v5
-        with:
-          images: ghcr.io/${{ env.REGISTRY_IMAGE }}
-
       - name: Login to Docker Hub
         uses: docker/login-action@v3
         with:
@@ -138,18 +111,9 @@ jobs:
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
 
-      - name: Create manifest list and push to ghcr.io
-        working-directory: /tmp/digests
-        run: |
-          docker buildx imagetools create -t ghcr.io/${{ env.REGISTRY_IMAGE }}:master-${{ matrix.ubuntu_version }}  \
-            $(printf 'ghcr.io/${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
-
-      - name: Create manifest list and push to DockerHub
-        working-directory: /tmp/digests
-        run: |
-          docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:master-${{ matrix.ubuntu_version }}  \
-            $(printf 'ghcr.io/${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
-
-      - name: Inspect image
+      - name: Merge images of ${{ matrix.docker }}:${{ matrix.ubuntu_version }}
         run: |
-          docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:master-${{ matrix.ubuntu_version }}
+          docker buildx imagetools create \
+             -t ${{ matrix.docker }}:master-${{ matrix.ubuntu_version }} \
+             ${{ matrix.docker }}:master-${{ matrix.ubuntu_version }}-amd64 \
+             ${{ matrix.docker }}:master-${{ matrix.ubuntu_version }}-arm64
index 7c78d7591ab6f2995b710eb411fdb9668dcb8b71..961eeee8d9a98efb809a061ff8cf8b43f8da52e6 100644 (file)
@@ -1,11 +1,10 @@
-ARG IMG=focal    # Ubuntu image that contains all corresponding dependencies.
+ARG IMG=noble    # Ubuntu image that contains all corresponding dependencies.
 
 FROM dealii/dependencies:$IMG
 
 ARG NJOBS=0      # Jobs used for building. Default: Use all available jobs.
 ARG VER=master   # deal.II branch that gets checked out.
-
-LABEL maintainer="luca.heltai@gmail.com"
+ARG FLAGS=""     # Additional flags for the build.
 
 USER root
 
@@ -18,7 +17,7 @@ RUN cd /usr/src && \
     -DCMAKE_PREFIX_PATH="/usr/lib/x86_64-linux-gnu/hdf5/openmpi;/usr/include/hdf5/openmpi" \
     -DDEAL_II_ALLOW_AUTODETECTION=OFF \
     -DDEAL_II_COMPONENT_PYTHON_BINDINGS=ON \
-    -DCMAKE_CXX_FLAGS="-std=c++17" \
+    -DCMAKE_CXX_FLAGS="-std=c++20 $FLAGS" \
     -DDEAL_II_WITH_64BIT_INDICES=OFF \
     -DDEAL_II_WITH_ADOLC=ON \
     -DDEAL_II_WITH_ARBORX=OFF \

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.