fix(docker): ship declared example/bench sources in build context#224
Conversation
The Railway/Docker build aborted at manifest parse:
error: failed to parse manifest at `/app/Cargo.toml`
Caused by:
can't find `amx_gemm_bench` example at `examples/amx_gemm_bench.rs` ...
Root cause: `.dockerignore` excluded `examples/` and `benches/` from the
build context, but Cargo.toml declares explicit [[example]]/[[bench]]
targets. Cargo validates that every explicitly-declared target's source
file exists while *parsing* the manifest — even for a lib-only build — so
`cargo build` aborts before compiling anything when those files are absent.
`amx_gemm_bench` was just the first missing target reported; all 18
examples and 13 root benches were stripped, and the ndarray-rand workspace
member's [[bench]] "bench" was also missing (its benches/ dir was never
copied — only Cargo.toml + src/).
Fix:
- .dockerignore: stop excluding examples/ and benches/ so they are present
in the build context (kept an NB comment explaining why).
- Dockerfile + Dockerfile.avx512: COPY examples/, benches/, and
ndarray-rand/benches/ before the build. These are NOT compiled by the
default `cargo build` (examples/benches require --examples/--benches), so
this adds only source bytes, not build time.
Verified by staging the exact Docker COPY set locally: without the dirs,
`cargo build` reproduces the parse error; with them, parse succeeds and the
build advances past target validation into dependency/lib compilation.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kq2xzjPj9p2eoP64uy3Btg
|
Warning Review limit reached
More reviews will be available in 37 minutes and 3 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Problem
The Railway/Docker build aborts at manifest parse, before compiling anything:
Root cause
This is not a missing file in the repo — it's a Docker build-context mismatch.
.dockerignoreexcludedexamples/andbenches/, whileCargo.tomldeclares explicit[[example]]/[[bench]]targets. Cargo validates that every explicitly-declared target's source file exists while parsing the manifest — even for a lib-only build — socargo buildaborts before any compilation when those files are absent.amx_gemm_benchwas merely the first missing target reported; all 18 examples and 13 root benches were stripped from the context.A second gap (caught by simulating the exact
COPYset): thendarray-randworkspace member also declares[[bench]] "bench", but the Dockerfile copied only itsCargo.toml+src/, neverndarray-rand/benches/. A root-only patch would have failed on that next. (crates/*members are safe —COPY crates/ crates/grabs them wholesale.)Verified that
cargo build --libdoes not skip this validation, so a Dockerfile flag tweak can't fix it — the declared files must be in the context.Fix
.dockerignore— stop excludingexamples//benches/so they're in the build context (kept anNBcomment so they aren't "tidied" back in).Dockerfile+Dockerfile.avx512—COPY examples/,COPY benches/,COPY ndarray-rand/benches/before the build.These dirs are not compiled by the default
cargo build(examples/benches require--examples/--benches), so this adds only source bytes, not build time.Verification
Staged the exact post-fix Docker
COPYset locally:amx_gemm_bench, thenndarray-randbench).(The only residual error in the isolated local test was an
--offlinerand-resolution artifact of the sandbox staging dir, which does not occur in Railway's networked build.)Note
The
Dockerfilelater runscargo test --release --lib -- hpc::. This PR resolves the manifest-parse failure blocking the very firstcargo buildstep. If the deployment later surfaces a compilation error, that's a separate issue downstream of this one.🤖 Generated with Claude Code
https://claude.ai/code/session_01Kq2xzjPj9p2eoP64uy3Btg
Generated by Claude Code