Skip to content

Commit

Permalink
Pull only when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
whoan committed Oct 28, 2023
1 parent 2558032 commit 46d5c67
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,11 @@ _build_image_buildkit() {
local cache_image
cache_image="$(_get_full_stages_image_name)":cache

local cache_from
if _can_pull; then
cache_from="--cache-from type=registry,ref=$cache_image"
fi

local cache_to
if _can_push; then
cache_to="--cache-to mode=max,image-manifest=true,type=registry,ref=$cache_image"
Expand All @@ -410,7 +415,7 @@ _build_image_buildkit() {
# shellcheck disable=SC2086
docker buildx build \
--load \
--cache-from type=registry,ref="$cache_image" \
$cache_from \
$cache_to \
--tag "$DUMMY_IMAGE_NAME" \
--file "${INPUT_CONTEXT}"/"${INPUT_DOCKERFILE}" \
Expand Down

0 comments on commit 46d5c67

Please sign in to comment.