From 158443f56ffcff0c41759735293b7245a827b25b Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Thu, 27 Feb 2025 10:37:21 +0100 Subject: [PATCH] docker: Build images for different platforms. --- .github/workflows/docker.yml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0f41b81d1e..a10169f506 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -16,19 +16,25 @@ env: 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: ubuntu-24.04 + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: ubuntu_version: [jammy, noble] - platform: [linux/amd64] - # Use only 2 jobs to build, as more jobs - # would starve the github machine for memory. + platform: [amd64, arm64] include: + - platform: amd64 + os: ubuntu-24.04 + - platform: arm64 + os: ubuntu-24.04-arm + # Use only 2 jobs to build, as more jobs + # would starve the github machine for memory. - n_jobs: 2 steps: @@ -41,9 +47,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -71,7 +74,7 @@ jobs: IMG=${{ matrix.ubuntu_version }} NJOBS=${{ matrix.n_jobs }} VER=master - platforms: ${{ matrix.platform }} + 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 @@ -85,19 +88,20 @@ jobs: - name: Upload digest uses: actions/upload-artifact@v4 with: - name: digests-${{ matrix.ubuntu_version }} + 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 + if: (github.event_name == 'schedule' && github.repository == 'dealii/dealii') || github.event_name != 'schedule' runs-on: ubuntu-24.04 needs: - build-master-docker-ubuntu -# Merge all images for a specific ubuntu version strategy: fail-fast: false matrix: @@ -108,7 +112,7 @@ jobs: uses: actions/download-artifact@v4 with: path: /tmp/digests - pattern: digests-${{ matrix.ubuntu_version }} + pattern: digests-${{ matrix.ubuntu_version }}-* merge-multiple: true - name: Set up Docker Buildx -- 2.39.5