Skip to content

Commit

Permalink
DockerビルドCI: リリースビルド時にlatest(masterブランチ)のレイヤーキャッシュを使うようにする (#707)
Browse files Browse the repository at this point in the history
  • Loading branch information
aoirint authored Jun 21, 2023
1 parent eae4ffe commit f67f1fe
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ jobs:
format('{0}:{1}-{2}', env.IMAGE_NAME, matrix.tag, needs.config.outputs.version_or_latest)
) || format('{0}:{1}', env.IMAGE_NAME, needs.config.outputs.version_or_latest)
) }}
IMAGE_CACHE_FROM:
|- # Always use the `latest` buildcache. :latest-buildcache or :{tag}-latest-buildcache
${{ (
matrix.tag != '' && (
format('type=registry,ref={0}:{1}-latest-buildcache', env.IMAGE_NAME, matrix.tag)
) || format('type=registry,ref={0}:latest-buildcache', env.IMAGE_NAME)
) }}
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
Expand All @@ -144,7 +151,7 @@ jobs:
target: ${{ matrix.target }}
push: true
tags: ${{ env.IMAGE_TAG }}
cache-from: type=registry,ref=${{ env.IMAGE_TAG }}-buildcache
cache-from: ${{ env.IMAGE_CACHE_FROM }}
cache-to: type=registry,ref=${{ env.IMAGE_TAG }}-buildcache,mode=max
platforms: ${{ matrix.platforms }}

Expand Down

0 comments on commit f67f1fe

Please sign in to comment.