From b5f8b883e78da844cc9ae62df2232b61925b1496 Mon Sep 17 00:00:00 2001 From: Andreas Fuchs Date: Wed, 16 Aug 2023 16:38:20 -0400 Subject: [PATCH] Use a matrix build for building the docker image Using parallel jobs means each worker can 100% dedicate itself to building for the relevant platform, rather than splitting its resources cross-compiling. --- .github/workflows/docker-publish.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index b41c2e8..5492237 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -24,6 +24,11 @@ jobs: docker_build: #if: github.event_name != 'pull_request' runs-on: ubuntu-latest + strategy: + matrix: + platform: + - linux/amd64 + - linux/arm64 permissions: contents: read packages: write @@ -58,12 +63,12 @@ jobs: # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action - - name: Build and push Docker image + - name: Build and push Docker image for ${{matrix.platform}} id: build-and-push uses: docker/build-push-action@v4 with: context: . - platforms: linux/amd64,linux/arm64 + platforms: ${{ matrix.platform }} push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}