Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to cache cargo-vcpkg dependencies? #298

Open
nnazo opened this issue Jan 30, 2025 · 0 comments
Open

How to cache cargo-vcpkg dependencies? #298

nnazo opened this issue Jan 30, 2025 · 0 comments

Comments

@nnazo
Copy link

nnazo commented Jan 30, 2025

I'm trying to use cargo-chef for a project that is using 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

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

No branches or pull requests

1 participant