LukeMathWalker / LukeMathWalker/cargo-chef
How to cache cargo-vcpkg dependencies?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.7k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to use cargo-chef for a project that is using [cargo-vcpkg](https://github.com/mcgoo/cargo-vcpkg) for building C++ dependencies.
Is this use case possible with cargo-chef? The following doesn't seem to have the caching effect I'd like since it rebuilds the C++ dependencies every time I make a change.
```
FROM chef AS ffi
COPY . .
RUN cargo vcpkg --verbose build --manifest-path subcrate/Cargo.toml
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /build/recipe.json recipe.json
COPY --from=ffi /build/target target
RUN cargo chef cook --recipe-path recipe.json
COPY . .
RUN cargo build --bin subcrate
```
The vcpkg build seems to require copying in the workspace Cargo.toml and the subcrate Cargo.toml and code as well, which is why I'm using 'COPY . .' in the ffi layer
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 by reproducing the shown Docker stages with cargo-vcpkg and cargo-chef using the workspace Cargo.toml, subcrate/Cargo.toml, recipe.json, and target directory. Compare which COPY inputs invalidate the ffi layer when source files change. Done means the documented approach preserves the C++ dependency cache across ordinary Rust source changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, rust
- Domain
- build-system, devops
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100