From 40d2c689b967bfd87e4bec43d62bd2ea73e82bd0 Mon Sep 17 00:00:00 2001 From: Juan Eugenio Abadie Date: Mon, 23 Oct 2023 22:58:30 +0200 Subject: [PATCH] Honor push_image_and_stages input --- docker-build.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docker-build.sh b/docker-build.sh index 116545e..efc05a5 100755 --- a/docker-build.sh +++ b/docker-build.sh @@ -385,6 +385,11 @@ _build_image_buildkit() { local cache_image cache_image="$(_get_full_stages_image_name)":latest + local cache_to + if _must_push; then + cache_to="--cache-to mode=max,image-manifest=true,type=registry,ref=$cache_image" + fi + _parse_extra_args set -x @@ -393,7 +398,7 @@ _build_image_buildkit() { docker buildx build \ --load \ --cache-from type=registry,ref="$cache_image" \ - --cache-to mode=max,image-manifest=true,type=registry,ref="$cache_image" \ + $cache_to \ --tag "$DUMMY_IMAGE_NAME" \ --file "${INPUT_CONTEXT}"/"${INPUT_DOCKERFILE}" \ ${INPUT_BUILD_EXTRA_ARGS} \