Add EFS-backed Fargate build cache support#3796
Open
ntner wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RUN --mount=type=cachedirectivesBuildCacheparameter that enables persistent layer caching for both EC2 and Fargate builds--cache-from/--cache-to type=registry,mode=max) with estargz, image-manifest, ignore-error--mount=type=cachepersistence + Kaniko ECR layer caching (--cache=true --cache-repo)New parameter
BuildCacheChanges
cmd/build/DockerfileFF_KANIKO_OCI_STAGES=0cmd/build/Dockerfile.armpkg/build/kaniko.go--tarPathto--tar-path+ conditional--cache=true/--cache-repopkg/build/docker.go--cache-from/--cache-toflags +--progress=plain+ service-aware cache refsprovider/aws/builds.goBUILD_CACHE+BUILD_CACHE_REPOenv vars,PlatformVersion: "1.4.0"on Fargatecmd/build/main.goBUILD_CACHE+BUILD_CACHE_REPOvia flag+env override patternprovider/aws/formation/rack.jsonDOCKER_BUILDKIT=1in EC2 task def, volumes/mounts in Fargate task defpkg/cli/rack.goBuildCachein build param groupEC2 registry cache design
Cache flags (
pkg/build/buildkit.goimageManifestCacheProviderbranch):--cache-to type=registry,ref={repo}:{service}.buildcache,mode=max,image-manifest=true,oci-mediatypes=true,ignore-error=true,compression=estargz--cache-from type=registry,ref={repo}:{service}.buildcache,ignore-error=true--no-cacheskips--cache-frombut still exports--cache-to(refreshes cache for future builds)Fargate EFS design
BuildCacheFilesystem(always encrypted, CMK when configured)fetchSecurityGroups()sha256-{hash}) accumulate in ECR; lifecycle policy recommended for cleanupBackward compatibility
BuildCachedefaults toNo. Disabled racks behave identically to today.BuildCache.--mount=type=cachedirectives previously ignored are now honored (cache ephemeral per task without EFS).DOCKER_BUILDKIT=1in the task definition (redundant with image-level ENV, but explicit). New task definition revision created on upgrade.PlatformVersion: "1.4.0"is a no-op (already the Fargate default).manifest1.Build(), notdocker.go).BuildImageusers:DOCKER_BUILDKIT=1is now forced via task definition. If the custom image ships Docker CLI, BuildKit mode is active.