docker: enable sccache (redis) in the Rust image build (JEF-84)#94
Merged
Conversation
Route rustc through sccache against the shared in-cluster Redis (sccache-redis.dev:6379); buildkit is now meshed and can reach it. - Remove cargo-chef entirely (chef/planner/cook stages) — it can't coexist with sccache (extern .rmeta files don't survive cook into the final build, sccache fatals; JEF-389). Collapsed to one build stage: COPY source, one cargo build. - sccache is a HARD GATE (no local fallback). SCCACHE_SERVER_PORT is randomised per build so concurrent buildkit sandboxes (shared netns) don't collide on the fixed default port 4226. CARGO_INCREMENTAL=0 is mandatory. - -gnu sccache tarball since the rust base is bookworm/glibc, not musl. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013cYVqzH7Xfwea7fAozdQK7
…sl is static, runs on glibc)
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.
Routes rustc through sccache against the shared in-cluster Redis (
sccache-redis.dev.svc.cluster.local:6379) inserver/Dockerfile. buildkit is now meshed and can reach that Service.Changes
chef/planner/cookstages). sccache and cargo-chef'scookcannot coexist: cargo always passes.rmetametadata externs, sccache hashes every--externinput, andcookleaves the shared target dir in a state where those.rmetafiles don't survive into the finalcargo build— sccache fatals (Failed to open file for hashing: …/lib*.rmeta) and aborts (JEF-389, confirmed real and backend-independent). Collapsed to a singlebuildstage: COPY source, onecargo build.RUSTC_WRAPPER=sccache,CARGO_INCREMENTAL=0,SCCACHE_REDIS=…. Uses the-gnutarball because the rust base image isrust:1-bookworm(glibc), not musl.cargo buildso sccache is a hard gate (no local fallback — if it can't reach Redis, the build fails) and start its server on a randomisedSCCACHE_SERVER_PORT. The random port is required because BuildKit sandboxes share a network namespace, so concurrent builds would collide on sccache's fixed default port 4226 (Address in use).The
uistage and the runtime/final stage are unchanged; the final stage still copies--from=build /app/target/release/watcher-server(target is baked into the build layer, as before — no target cache mount).🤖 Generated with Claude Code