chore: Local Docker build perf - #2406
Open
sergerad wants to merge 1 commit into
Open
Conversation
sergerad
enabled auto-merge (squash)
July 29, 2026 22:07
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.
Speed up
make local-network-buildmake local-network-buildcompiled the full dependency tree (including RocksDB from source) once per image: the Dockerfile's cache mounts are keyed perBINto keep concurrent CI matrix jobs from corrupting shared mounts, but local builds are sequential, so the keying just multiplied work five-fold. The unconditional sourcetouchalso forced a full workspace rebuild on every build.Changes
builder-localstage: compiles all five binaries in a single cargo invocation with cache mounts shared across binaries. The stage never referencesBIN, so its layers are identical across all five image builds — the first build compiles, the remaining four hit BuildKit's layer cache.touchin the local stage: local build contexts preserve real mtimes (and git bumps the mtime of anything it changes), so Cargo's fingerprinting is sound and rebuilds are genuinely incremental. The.cargo-okregistry heal is kept since Ctrl-C'd local builds corrupt the registry the same way cancelled CI jobs do.CARGO_BUILD_JOBS): an uncapped build OOMs the default 8GiB Docker Desktop VM because the release profile carries full debug info.BUILDERbuild arg (builder-cidefault, renamed frombuilder). CI is unaffected: it never passes the arg, thebuilder-ciinstructions are unchanged (so no cache invalidation), andbuilder-localis unreachable in CI builds.local-network-buildpassesBUILDER=builder-localand drops--pull; deduped the doubleddocker-build-monitorprerequisite; tightened Dockerfile comments (including correcting the "Docker normalises COPY timestamps" claim — the stale-rlib hazard comes from the target cache mount being shared across builds of divergent sources, not from COPY).Result: a cold
make local-network-buildcompiles the workspace once instead of five times; a no-change rebuild goes from five full workspace rebuilds to a cache hit; a small change recompiles only affected crates, once.Changelog