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
WORKDIR /build/pass_manager
RUN apk -U upgrade --no-cache && apk add --no-cache musl-dev
COPY . .
RUN cargo install --path .
FROM rust:slim AS chef
RUN cargo install cargo-chef
WORKDIR /app
FROM docker.io/alpine
WORKDIR /app/
RUN apk -U upgrade --no-cache
COPY --from=builder /usr/local/cargo/bin/pass_manager .
CMD ["./pass_manager"]
FROM chef AS planner
COPY . .
RUN cargo chef prepare
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" ]