Skip to content

Commit 255bee7

Browse files
committed
Cache Docker build layers with type=gha
The docker.yml build had no build cache, so every run rebuilt the image from scratch. Add buildx type=gha cache scoped per platform so layers are reused across runs.
1 parent de6d22b commit 255bee7

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

.github/workflows/docker.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ jobs:
6060
with:
6161
context: .
6262
platforms: ${{ matrix.platform }}
63+
cache-from: type=gha,scope=${{ matrix.platform }}
64+
cache-to: type=gha,scope=${{ matrix.platform }},mode=max,ignore-error=true
6365
build-args: |
6466
CI=github
6567
GITHUB_SHA=${{ github.event.workflow_run.head_sha }}
@@ -73,6 +75,8 @@ jobs:
7375
with:
7476
context: .
7577
platforms: ${{ matrix.platform }}
78+
# reuse the layers the ghcr build just cached so this is a cache hit, not a full rebuild
79+
cache-from: type=gha,scope=${{ matrix.platform }}
7680
build-args: |
7781
CI=github
7882
GITHUB_SHA=${{ github.event.workflow_run.head_sha }}

0 commit comments

Comments
 (0)