Files
temperature-numerics/Dockerfile
2021-06-28 15:51:05 +02:00

27 lines
888 B
Docker

FROM rust:latest as planner
WORKDIR /app
RUN cargo install cargo-chef --version 0.1.21
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM rust:latest as cacher
WORKDIR /app
RUN cargo install cargo-chef --version 0.1.21
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
FROM rust:latest as builder
RUN rustup target add x86_64-unknown-linux-musl
RUN apt update && apt install -y musl-tools musl-dev
RUN update-ca-certificates
WORKDIR /app
COPY . .
COPY --from=cacher /app/target target
COPY --from=cacher $CARGO_HOME $CARGO_HOME
RUN cargo build --target x86_64-unknown-linux-musl --release && strip -s /app/target/x86_64-unknown-linux-musl/release/temperature-numerics
FROM scratch
WORKDIR /app
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/temperature-numerics .
CMD ["/app/temperature-numerics"]