Skip to content

Commit

Permalink
build: Attempt to improve docker build cache in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Mar 21, 2024
1 parent 953151d commit c505497
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
strategy:
matrix:
package: [web, workers]
platform: [linux/amd64, linux/arm64]
runs-on: ubuntu-latest
permissions:
packages: write
Expand All @@ -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
Expand All @@ -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 }}

0 comments on commit c505497

Please sign in to comment.