Skip to content

Commit

Permalink
DockerビルドCI: リリースビルド時にレイヤーキャッシュをpushしないようにする (#708)
Browse files Browse the repository at this point in the history
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
  • Loading branch information
aoirint and Hiroshiba authored Jun 21, 2023
1 parent f67f1fe commit 3974766
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ jobs:
format('type=registry,ref={0}:{1}-latest-buildcache', env.IMAGE_NAME, matrix.tag)
) || format('type=registry,ref={0}:latest-buildcache', env.IMAGE_NAME)
) }}
IMAGE_CACHE_TO:
|- # If it's a release, do not create buildcache, otherwise create the `latest` buildcache. :latest-buildcache or :{tag}-latest-buildcache
${{ (
needs.config.outputs.version_or_latest == 'latest' && (
matrix.tag != '' && (
format('type=registry,ref={0}:{1}-latest-buildcache,mode=max', env.IMAGE_NAME, matrix.tag)
) || format('type=registry,ref={0}:latest-buildcache,mode=max', env.IMAGE_NAME)
) || ''
) }}
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
Expand All @@ -152,7 +161,7 @@ jobs:
push: true
tags: ${{ env.IMAGE_TAG }}
cache-from: ${{ env.IMAGE_CACHE_FROM }}
cache-to: type=registry,ref=${{ env.IMAGE_TAG }}-buildcache,mode=max
cache-to: ${{ env.IMAGE_CACHE_TO }}
platforms: ${{ matrix.platforms }}

run-release-test-workflow:
Expand Down

0 comments on commit 3974766

Please sign in to comment.