Updated docker file for better caching

This commit is contained in:
StNicolay 2023-06-20 20:40:43 +03:00
parent f8d7807c6c
commit 9ef17f31fe
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D

View File

@ -1,11 +1,18 @@
FROM docker.io/rust:alpine as builder FROM rust:slim AS chef
WORKDIR /build/pass_manager RUN cargo install cargo-chef
RUN apk -U upgrade --no-cache && apk add --no-cache musl-dev WORKDIR /app
COPY . .
RUN cargo install --path .
FROM docker.io/alpine FROM chef AS planner
WORKDIR /app/ COPY . .
RUN apk -U upgrade --no-cache RUN cargo chef prepare
COPY --from=builder /usr/local/cargo/bin/pass_manager .
CMD ["./pass_manager"] FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release
COPY . .
RUN cargo b -r
FROM debian:buster-slim
WORKDIR /app
COPY --from=builder /app/target/release/pass_manager .
CMD [ "./pass_manager" ]