ci: replace sed/awk Dockerfile rewriting with --build-context overrides#987
Merged
Conversation
Replace the fragile sed/awk-based Dockerfile rewriting in docker-smoke-test.yml with Docker BuildKit --build-context overrides. Instead of parsing and rewriting Dockerfiles at CI time, we now: 1. Create fake builder directories with pre-built binaries at the expected paths (build/target/release/<binary>) 2. Pass --build-context builder=.fake-builder to docker buildx build 3. Docker skips the entire Rust build stage and uses our directory instead This handles multi-stage builds (e.g. Dockerfile.antigravity with adapter-builder) automatically by detecting all named Rust stages. Benefits: - No fragile string manipulation in CI - Dockerfiles remain unmodified and self-contained - Multi-stage builds work without special-casing - BuildKit fully skips Rust stages (faster CI) Fixes #986
|
All PRs must reference a prior Discord discussion to ensure community alignment before implementation. Please edit the PR description to include a link like: This PR will be automatically closed in 3 days if the link is not added. |
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
Replace the fragile sed/awk-based Dockerfile rewriting in
docker-smoke-test.ymlwith Docker BuildKit--build-contextoverrides.What changed
The "Build image (skip Rust compilation)" step now:
.fake-builder/build/target/release/openabwith the pre-built binary--build-context builder=.fake-buildertodocker buildx buildadapter-builderinDockerfile.antigravity) and overrides them tooDocker BuildKit completely skips the original
FROM ruststages when a--build-contextoverride is provided, using our fake directory as the stage context instead.Before (sed/awk rewriting)
awkstrips allFROM ruststages from the DockerfileAfter (--build-context)
Testing
CI will validate this on all 12 Dockerfile variants in the matrix.
Fixes #986