From 4c54c11adcc31c894a954a2e5a4e6a3209effbe4 Mon Sep 17 00:00:00 2001 From: Luca Palmieri Date: Tue, 31 Aug 2021 23:39:41 +0200 Subject: [PATCH] Update Dockerfile. --- Dockerfile | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3d2d368..25319ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,18 @@ -FROM lukemathwalker/cargo-chef:latest-rust-1.53.0 as planner +FROM lukemathwalker/cargo-chef:latest-rust-1.53.0 as chef WORKDIR /app + +FROM chef as planner COPY . . # Compute a lock-like file for our project RUN cargo chef prepare --recipe-path recipe.json -FROM lukemathwalker/cargo-chef:latest-rust-1.53.0 as cacher -WORKDIR /app +FROM chef as builder COPY --from=planner /app/recipe.json recipe.json # Build our project dependencies, not our application! RUN cargo chef cook --release --recipe-path recipe.json - -FROM rust:1.53.0 AS builder -WORKDIR /app -# Copy over the cached dependencies -COPY --from=cacher /app/target target -COPY --from=cacher /usr/local/cargo /usr/local/cargo COPY . . ENV SQLX_OFFLINE true +# Build our project RUN cargo build --release --bin zero2prod FROM debian:buster-slim AS runtime