Skip to content

Add support for --example to cargo chef cook #322

Description

@AnomalRoil

I'm building some example code using:

FROM chef AS planner

COPY . .
RUN cargo chef prepare --recipe-path recipe.json --bin my-example

FROM chef AS builder

COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json

COPY . .
RUN cargo build --release -p my-example --example my-example

And sadly it seems the dependencies that are being compiled by the cook step are not the same ones as the ones used by cargo build --example my-example, and so it's rebuilding it all.

I've found that cook supports --examples, but it seems sometimes it's not always building all the required dependencies for my example binaries, it allows to not rebuild all the dependencies, however, only a few.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions