Skip to content

Fix Docker build cache poisoning, add Docker build to PR validation#12

Merged
AndrewAltimit merged 3 commits into
mainfrom
fix/docker-build-cache-and-pr-validation
Feb 22, 2026
Merged

Fix Docker build cache poisoning, add Docker build to PR validation#12
AndrewAltimit merged 3 commits into
mainfrom
fix/docker-build-cache-and-pr-validation

Conversation

@AndrewAltimit
Copy link
Copy Markdown
Owner

Summary

  • Fix Docker build failure: The v0.1.0 release 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.
  • Add Docker Build Check to PR validation: The PR pipeline previously had no Docker build step, so this class of failure was invisible until release time. Added a docker-build job 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:

  1. Copy Cargo.toml files + create empty stub lib.rs files -> cargo build to compile dependencies into --mount=type=cache
  2. COPY crates/ (real source overwrites stubs) -> cargo build again with the same cache mount

The 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 .rlib files.

Changes

File Change
docker/server.Dockerfile Add fingerprint purge step (find ... -name "breakpoint*" -path "*/fingerprint/*" -exec rm) between stub build and real build
.github/workflows/pr-validation.yml Add docker-build job (build image + healthcheck smoke test), include it in PR status summary

Test plan

  • PR validation pipeline runs the new Docker Build Check job successfully
  • Re-tag v0.1.0 (or create v0.1.1) after merge to verify release pipeline Docker step passes
  • Verify the built Docker image starts and responds to /api/v1/status

Generated with Claude Code

AI Agent Bot and others added 3 commits February 21, 2026 16:02
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>
@AndrewAltimit AndrewAltimit merged commit 90fb3ac into main Feb 22, 2026
10 checks passed
@AndrewAltimit AndrewAltimit deleted the fix/docker-build-cache-and-pr-validation branch February 22, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant