Fix Docker build cache poisoning, add Docker build to PR validation#12
Merged
Merged
Conversation
The v0.1.0 release pipeline failed because the Dockerfile's dependency pre-caching strategy uses stub source files with --mount=type=cache, but cargo fingerprints in the cache are not invalidated when real source files replace the stubs. This causes cargo to skip recompiling workspace crates, linking the server against empty stubs (41 compile errors). Fix by purging stale cargo fingerprints for workspace crates between the stub dependency build and the real source build. Also add a Docker Build Check job to pr-validation.yml so Docker image builds are validated before merging, preventing this class of failure from reaching release. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The find command used */fingerprint/* but cargo stores fingerprints in a .fingerprint directory (with leading dot). This caused the purge to match nothing, leaving stale stub fingerprints intact. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The breakpoint-client crate uses include_str!("../../../web/theme.json")
at compile time, but the Dockerfile only copied crates/ into the builder
stage. The web/ directory was only copied into the runtime stage.
Verified: Docker image builds successfully end-to-end locally.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
v0.1.0release pipeline failed at the Docker image build step because the Dockerfile's dependency pre-caching strategy uses stub source files with--mount=type=cache, but stale cargo fingerprints in the cache prevent cargo from recompiling workspace crates when real source replaces the stubs. This caused 41 compile errors (e.g.could not find 'net' in 'breakpoint_core'). Fixed by purging workspace crate fingerprints from the cache between the stub build and real build.docker-buildjob that builds the production image and smoke-tests it with a healthcheck, running in parallel with browser tests after CI passes.Root cause
The Dockerfile uses a two-phase build pattern for dependency caching:
Cargo.tomlfiles + create empty stublib.rsfiles ->cargo buildto compile dependencies into--mount=type=cacheCOPY crates/(real source overwrites stubs) ->cargo buildagain with the same cache mountThe problem: cargo fingerprints in the cache mount persist across steps. When real source replaces stubs, cargo sees matching fingerprints and skips recompiling workspace crates, linking the server binary against the empty stub
.rlibfiles.Changes
docker/server.Dockerfilefind ... -name "breakpoint*" -path "*/fingerprint/*" -exec rm) between stub build and real build.github/workflows/pr-validation.ymldocker-buildjob (build image + healthcheck smoke test), include it in PR status summaryTest plan
v0.1.0(or createv0.1.1) after merge to verify release pipeline Docker step passes/api/v1/statusGenerated with Claude Code