# cargo binstall provides a low-complexity mechanism for installing rust binaries as an alternative to building from source (via cargo install) or manually downloading packages.
# This is intended to work with existing CI artifacts and infrastructure, and with minimal overhead for package maintainers.
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/app/target \
cargo install cargo-binstall
# cache the dependencies of your Rust project and speed up your Docker builds.
RUN --mount=type=cache,target=/usr/local/cargo/registry \
# prepare examines your project and builds a recipe that captures the set of information required to build your dependencies.
# The recipe.json is the equivalent of the Python requirements.txt file - it is the only input required for cargo chef cook, the command that will build out our dependencies:
#
FROM chef AS prepare
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \