From 3224cc8ce794b7d3cc7cc9464019c8887bb1b95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Strate=20Kl=C3=B8vedal?= Date: Sun, 28 Mar 2021 19:39:22 +0200 Subject: [PATCH] Use a ghaction matrix in docker build to build each architecture individually --- .github/workflows/build.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 474d9a3f..ffea4659 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,5 @@ name: Docker builds -env: - TARGET_PLATFORMS: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 - on: schedule: - cron: "0 10 * * *" # everyday at 10am @@ -17,6 +14,15 @@ jobs: build: name: Build and deploy docker images runs-on: ubuntu-20.04 + + strategy: + matrix: + target_platform: + - "linux/amd64" + - "linux/arm/v6" + - "linux/arm/v7" + - "linux/arm64" + steps: - name: Checkout uses: actions/checkout@v2 @@ -26,14 +32,14 @@ jobs: id: cache with: path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ secrets.CACHE_KEY }}-${{ github.sha }} + key: ${{ runner.os }}-buildx-${{ secrets.CACHE_KEY }}-${{ matrix.target_platform }}-${{ github.sha }} restore-keys: | - ${{ runner.os }}-buildx-${{ secrets.CACHE_KEY }}- + ${{ runner.os }}-buildx-${{ secrets.CACHE_KEY }}-${{ matrix.target_platform }}- - name: Set up QEMU uses: docker/setup-qemu-action@v1 with: - platforms: ${{ env.TARGET_PLATFORMS }} + platforms: ${{ matrix.target_platform }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 @@ -43,7 +49,7 @@ jobs: run: | DOCKER_USERNAME=viktorstrate DOCKER_IMAGE=viktorstrate/photoview - DOCKER_PLATFORMS=${TARGET_PLATFORMS} + DOCKER_PLATFORMS=${{ matrix.target_platform }} VERSION=edge if [[ $GITHUB_REF == refs/tags/* ]]; then