2023-05-28 22:00:23 +02:00
|
|
|
# https://www.lpalmieri.com/posts/fast-rust-docker-builds/
|
|
|
|
FROM rust:alpine AS rust
|
|
|
|
RUN apk add musl-dev openssl-dev
|
|
|
|
RUN cargo install cargo-chef
|
|
|
|
WORKDIR app
|
|
|
|
|
|
|
|
FROM rust AS planner
|
|
|
|
COPY . .
|
|
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
|
|
|
|
FROM rust AS builder
|
|
|
|
COPY --from=planner /app/recipe.json recipe.json
|
|
|
|
RUN cargo chef cook --release --recipe-path recipe.json
|
|
|
|
COPY . .
|
|
|
|
RUN cargo build --release --bin obsessed-yanqing
|
|
|
|
|
|
|
|
|
|
|
|
FROM alpine:latest
|
|
|
|
RUN apk add --no-cache libc6-compat
|
2023-06-26 13:56:58 +02:00
|
|
|
COPY --from=builder /app/target/release/obsessed-yanqing .
|
|
|
|
CMD ["./obsessed-yanqing"]
|