6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2025-01-09 16:36:29 +00:00

fix: When pushing images to registry cache, use image-manifest=true

Without this change, when building images with --cache-to-registry,
BuildKit uses a proprietary cache artifact format, which breaks
when using third-party registries such as Harbor or ECR.

By adding the image-manifest=true option, BuildKit uses an
OCI-compliant cache artifact format that should be compatible with all
registries. This option requires BuildKit 0.12 or later (check with
"docker buildx ls").

See https://github.com/goharbor/harbor/issues/18941 and
https://github.com/moby/buildkit/issues/2251 for background
information.

Co-authored-by: Andrés González <andres@aulasneo.com>

Fixes #1118.
This commit is contained in:
Florian Haas 2024-11-19 11:11:46 +01:00 committed by Régis Behmo
parent a666732f1a
commit 8c7996c278
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,8 @@
- [Improvement] When building images with
`tutor images build --cache-to-registry`, use an OCI-compliant cache
artifact format that should be universally compatible with all
registries. This enables the use of that option when working with
third-party registries such as [Harbor](https://goharbor.io/) or
[ECR](https://aws.amazon.com/ecr/). Requires
[BuildKit 0.12](https://github.com/moby/buildkit/releases/tag/v0.12.0)
or later. (by @angonz and @fghaas)

View File

@ -227,7 +227,7 @@ def build(
image_build_args.append(f"--cache-from=type=registry,ref={tag}-cache")
if cache_to_registry:
image_build_args.append(
f"--cache-to=type=registry,mode=max,ref={tag}-cache"
f"--cache-to=type=registry,mode=max,ref={tag}-cache,image-manifest=true"
)
# Build contexts