Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create docker images for the various packages used in this paper | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: | |
| - release | |
| - main | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| build-image: | |
| strategy: | |
| matrix: | |
| backend: ["firedrake", "dolfinx", "mfem"] | |
| platform: [ | |
| { runner: "ubuntu-24.04", platform: amd64 }, | |
| #{ runner: "ubuntu-24.04-arm", platform: arm64 }, # NOTE: Skip arm until repo is public | |
| ] | |
| runs-on: ${{ matrix.platform.runner }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.backend }} | |
| - name: Split metadata | |
| id: split | |
| env: | |
| FULL_TAG: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }} | |
| run: echo "image=${FULL_TAG%%:*}" >> $GITHUB_OUTPUT | |
| - name: Build and push Docker image | |
| id: build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: docker/Dockerfile.${{ matrix.backend }} | |
| platforms: linux/${{ matrix.platform.platform }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| outputs: type=image,"name=${{ steps.split.outputs.image }}",push-by-digest=true,name-canonical=true,push=true | |
| - name: Export digest | |
| run: | | |
| mkdir -p ${{ runner.temp }}/digests | |
| digest="${{ steps.build.outputs.digest }}" | |
| touch "${{ runner.temp }}/digests/${digest#sha256:}" | |
| - name: Upload digest | |
| #if: github.event_name == 'push' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: digests-${{ matrix.backend }}-${{ matrix.platform.platform }} | |
| path: ${{ runner.temp }}/digests/* | |
| if-no-files-found: error | |
| retention-days: 1 | |
| merge-and-publish: | |
| #if: github.event_name == 'push' | |
| strategy: | |
| matrix: | |
| backend: ["firedrake", "dolfinx", "mfem"] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| needs: | |
| - build-image | |
| steps: | |
| - name: Download digests | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ${{ runner.temp }}/digests | |
| pattern: digests-${{ matrix.backend }}* | |
| merge-multiple: true | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.backend }} | |
| - name: Split metadata | |
| id: split | |
| env: | |
| FULL_TAG: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }} | |
| run: echo "image=${FULL_TAG%%:*}" >> $GITHUB_OUTPUT | |
| - name: Create manifest list and push | |
| working-directory: ${{ runner.temp }}/digests | |
| run: | | |
| docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
| $(printf '${{ steps.split.outputs.image }}@sha256:%s ' *) | |
| - name: Inspect image | |
| run: | | |
| docker buildx imagetools inspect ${{ steps.split.outputs.image }}:${{ steps.meta.outputs.version }} |