Skip to content

How to cache cargo-vcpkg dependencies? #298

@nnazo

Description

@nnazo

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions