Use cache feature of docker buildx

This commit is contained in:
Mikhail f. Shiryaev 2021-12-24 17:15:08 +01:00
parent 2a83a1c05d
commit 7bc89c4f50
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4

View File

@ -125,9 +125,12 @@ def build_and_push_one_image(
"w",
) as pl:
cmd = (
"docker buildx build --builder default --build-arg "
f"FROM_TAG={version_string} --tag {image_name}:{version_string} "
f"--push {path}"
"docker buildx build --builder default "
f"--build-arg FROM_TAG={version_string} "
f"--build-arg BUILDKIT_INLINE_CACHE=1 "
f"--tag {image_name}:{version_string} "
f"--cache-from type=registry,ref={image_name}:{version_string} "
f"--progress plain --push {path}"
)
logging.info("Docker command to run: %s", cmd)
retcode = subprocess.Popen(cmd, shell=True, stderr=pl, stdout=pl).wait()