With the previous Rust version 1.61, the build fails with > error[E0658]: use of unstable library feature 'scoped_threads' This has been "stabilized" in Rust 1.63. To avoid the hassle of manually updating the version, we can just default to the latest minor release.
27 lines
841 B
Docker
Executable File
27 lines
841 B
Docker
Executable File
# See https://github.com/LukeMathWalker/cargo-chef
|
|
ARG RUST_VERSION=1-buster
|
|
FROM rust:${RUST_VERSION} as planner
|
|
WORKDIR /scryer-prolog
|
|
RUN cargo install cargo-chef
|
|
COPY . .
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
FROM rust:${RUST_VERSION} as cacher
|
|
WORKDIR /scryer-prolog
|
|
RUN cargo install cargo-chef
|
|
COPY --from=planner /scryer-prolog/recipe.json recipe.json
|
|
RUN cargo chef cook --release --recipe-path recipe.json
|
|
|
|
FROM rust:${RUST_VERSION} as builder
|
|
WORKDIR /scryer-prolog
|
|
COPY . .
|
|
# Copy over the cached dependencies
|
|
COPY --from=cacher /scryer-prolog/target target
|
|
COPY --from=cacher $CARGO_HOME $CARGO_HOME
|
|
RUN cargo build --release --bin scryer-prolog
|
|
|
|
FROM debian:stable-slim
|
|
COPY --from=builder /scryer-prolog/target/release/scryer-prolog /usr/local/bin
|
|
ENV RUST_BACKTRACE=1
|
|
ENTRYPOINT ["/usr/local/bin/scryer-prolog"]
|