FROM rust:1.59 as builder RUN USER=root cargo new --bin jean-marie WORKDIR /jean-marie COPY ./Cargo.toml ./Cargo.toml RUN cargo build --release RUN rm src/*.rs ADD . ./ RUN rm ./target/release/deps/jean_marie* RUN cargo build --release FROM debian:buster-slim COPY --from=builder /jean-marie/target/release/jean-marie . RUN mkdir -p /templates CMD ["./jean-marie"]