PR: #55 (feat/27-docker-compose)
Files: Dockerfile lines 19-31
The Dockerfile comment states:
Manifests first so the dep layer caches separately from source. Dummy src/main.rs is cheaper than copying the full workspace when only Cargo.* changes.
However the actual layer sequence is:
COPY Cargo.toml Cargo.lock ./
COPY crates ./crates # entire source tree in one layer
RUN --mount=type=cache ...
cargo build --locked --release --bin charon
There is no dummy-src step. COPY crates ./crates copies the entire source tree before the build. Any change to any file in any crate — including test files, doc comments, or non-binary library crates — invalidates the COPY crates layer, which in turn forces a full recompile. The BuildKit --mount=type=cache mounts persist the target/ directory across independent builds on the same host but do not help when the copy layer above changes.
The comment promises behavior that is not implemented. On first deploy or after a Cargo.lock update, full dependency compilation from scratch takes 5-15 minutes on a CX22 2 vCPU machine.
Suggested fix: Either implement the advertised dummy-src pattern (create stub src/main.rs per crate after copying manifests, build deps, then COPY real source and rebuild), or use cargo-chef (LukeMathWalker/cargo-chef) which handles this automatically for multi-crate workspaces. At minimum, remove the misleading comment so operators do not expect fast incremental rebuilds.
Refs #55
PR: #55 (feat/27-docker-compose)
Files: Dockerfile lines 19-31
The Dockerfile comment states:
However the actual layer sequence is:
There is no dummy-src step.
COPY crates ./cratescopies the entire source tree before the build. Any change to any file in any crate — including test files, doc comments, or non-binary library crates — invalidates theCOPY crateslayer, which in turn forces a full recompile. The BuildKit--mount=type=cachemounts persist thetarget/directory across independent builds on the same host but do not help when the copy layer above changes.The comment promises behavior that is not implemented. On first deploy or after a Cargo.lock update, full dependency compilation from scratch takes 5-15 minutes on a CX22 2 vCPU machine.
Suggested fix: Either implement the advertised dummy-src pattern (create stub
src/main.rsper crate after copying manifests, build deps, then COPY real source and rebuild), or usecargo-chef(LukeMathWalker/cargo-chef) which handles this automatically for multi-crate workspaces. At minimum, remove the misleading comment so operators do not expect fast incremental rebuilds.Refs #55