LukeMathWalker / LukeMathWalker/cargo-chef
toolchain in recipe.json is ignored in `cargo chef cook`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.7k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Description
cargo chef cook generates rust-toolchain.toml file, but it's not used in the subsequent build of dependencies.
rust-toolchain.toml takes effect when cargo is invoked next time. Therefore, executing cargo chef cook twice results in building with the wrong toolchain for the first time and the correct building for the second time.
The following Dockerfile reproduces the problem.
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /app
FROM chef AS planner
RUN echo '[workspace]\nresolver = "2"\nmembers = ["hello"]' > Cargo.toml
RUN cargo new hello
RUN echo '[toolchain]\nchannel = "1.75.0"' > rust-toolchain.toml
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json # does not install 1.75.0
RUN cargo chef cook --release --recipe-path recipe.json # does install 1.75.0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Dockerfile reproduction and inspect how cargo chef cook processes recipe.json and the generated rust-toolchain.toml. Verify the first cook invocation uses the toolchain declared in the recipe, then rerun the two cook commands to confirm the second-run discrepancy is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, rust
- Domain
- build-system, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100