From 95e403575a8cd78ed177ecdecc153e0068b008aa Mon Sep 17 00:00:00 2001 From: Luca Palmieri Date: Wed, 4 Nov 2020 10:09:04 +0000 Subject: [PATCH] Use debian as base image. (#16) --- chapter05/Dockerfile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/chapter05/Dockerfile b/chapter05/Dockerfile index e128e5a..9b72852 100644 --- a/chapter05/Dockerfile +++ b/chapter05/Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.47 as planner +FROM rust:1.47 AS planner WORKDIR app # We only pay the installation cost once, # it will be cached from the second build onwards @@ -9,14 +9,14 @@ COPY . . # Compute a lock-like file for our project RUN cargo chef prepare --recipe-path recipe.json -FROM rust:1.47 as cacher +FROM rust:1.47 AS cacher WORKDIR app RUN cargo install cargo-chef 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.47 as builder +FROM rust:1.47 AS builder WORKDIR app # Copy over the cached dependencies COPY --from=cacher /app/target target @@ -26,8 +26,12 @@ COPY . . ENV SQLX_OFFLINE true RUN cargo build --release --bin chapter05 -FROM rust:1.47-slim as runtime +FROM debian:buster-slim AS runtime WORKDIR app +RUN apt-get update -y \ + && apt-get install -y --no-install-recommends openssl \ + # Clean up + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* COPY --from=builder /app/target/release/chapter05 zero2prod COPY configuration configuration ENV APP_ENVIRONMENT production