feat: support custom BuildKit frontends#83
Open
zachspar wants to merge 1 commit into
Open
Conversation
51396f4 to
1a73baf
Compare
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.
Background
This PR implements my feature request in #82 to enable building images using custom BuildKit frontends (ie.
# syntax=ghcr.io/builderhub/yamlfile:latest,BUILDKIT_SYNTAX, and explicitgateway.v0metadata), while keeping the existing nativedockerfile.v1path for plain Dockerfiles.Previously the shim always parsed the build file as a Dockerfile before the build started and always ran a hard-coded
dockerfile.v1frontend. That broke external frontends like Yamlfile with errors such asunknown instruction: apiVersion:.New Approach
Native Dockerfiles keep existing shim-specific behavior. External frontends delegate to the declared frontend image via BuildKit’s gateway mechanism.
Eventually it would be nice if we wire
frontend/frontend-optmetadata fromcontainer, but that is not a requirement to achieve the desired behavior.flowchart TD Input[Build file bytes] --> Resolve[resolveFrontend] Resolve -->|native| Native[Skip external path] Native --> Parse[parseDockerfileMetadata + dockerfile.v1] Resolve -->|external| Skip[Skip Dockerfile parse] Skip --> Stage[stageBuildDefinition + fssync staging] Stage --> Gateway[forwardGateway to gateway.v0]