mirror of
https://github.com/speyejack/smo-multi-rs.git
synced 2025-10-05 15:42:45 +02:00
use cargo chef to better cache docker layers
This commit is contained in:
26
Dockerfile
26
Dockerfile
@@ -1,7 +1,29 @@
|
||||
FROM rust:1.63 AS builder
|
||||
FROM rust:1.63 AS base
|
||||
|
||||
RUN cargo install cargo-chef
|
||||
|
||||
########################################################################
|
||||
|
||||
FROM base AS planner
|
||||
|
||||
WORKDIR /app/
|
||||
COPY . .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
########################################################################
|
||||
|
||||
FROM base 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 smo-rs
|
||||
|
||||
FROM debian:buster-slim
|
||||
########################################################################
|
||||
|
||||
FROM debian:buster-slim AS runtime
|
||||
|
||||
COPY --from=builder ./target/release/smo-rs ./target/release/smo-rs
|
||||
|
||||
ENTRYPOINT ["/target/release/smo-rs"]
|
||||
|
@@ -1,7 +1,29 @@
|
||||
FROM rust:1.63 AS builder
|
||||
FROM rust:1.63 AS base
|
||||
|
||||
RUN cargo install cargo-chef
|
||||
|
||||
########################################################################
|
||||
|
||||
FROM base AS planner
|
||||
|
||||
WORKDIR /app/
|
||||
COPY . .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
########################################################################
|
||||
|
||||
FROM base AS builder
|
||||
|
||||
COPY --from=planner /app/recipe.json ./recipe.json
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
|
||||
COPY . .
|
||||
RUN cargo build --package proxy --release
|
||||
|
||||
FROM debian:buster-slim
|
||||
########################################################################
|
||||
|
||||
FROM debian:buster-slim AS runtime
|
||||
|
||||
COPY --from=builder ./target/release/proxy ./target/release/proxy
|
||||
|
||||
ENTRYPOINT ["/target/release/proxy"]
|
||||
|
Reference in New Issue
Block a user