From c50549799432f11fd1bee9417fafc0129dedd021 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Thu, 21 Mar 2024 05:11:51 +0000 Subject: [PATCH] build: Attempt to improve docker build cache in CI --- .github/workflows/docker.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 99b0520a..accea7a3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,6 +11,7 @@ jobs: strategy: matrix: package: [web, workers] + platform: [linux/amd64, linux/arm64] runs-on: ubuntu-latest permissions: packages: write @@ -34,11 +35,11 @@ jobs: context: . file: docker/Dockerfile target: ${{ matrix.package }} - platforms: linux/amd64,linux/arm64 + platforms: ${{ matrix.platform }} push: true tags: ghcr.io/mohamedbassem/hoarder-${{ matrix.package }}:latest - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=${{ matrix.package }}-${{ matrix.platform }} + cache-to: type=gha,mode=max,scope=${{ matrix.package }}-${{ matrix.platform }} - name: Build ${{ matrix.package }} (release) uses: docker/build-push-action@v5 @@ -47,8 +48,8 @@ jobs: context: . file: docker/Dockerfile target: ${{ matrix.package }} - platforms: linux/amd64,linux/arm64 + platforms: ${{ matrix.platform }} push: true tags: ghcr.io/mohamedbassem/hoarder-${{ matrix.package }}:${{github.event.release.name}},ghcr.io/mohamedbassem/hoarder-${{ matrix.package }}:release - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=${{ matrix.package }}-${{ matrix.platform }} + cache-to: type=gha,mode=max,scope=${{ matrix.package }}-${{ matrix.platform }}