mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2024-11-21 16:21:01 +00:00
Use debian as base image. (#16)
This commit is contained in:
parent
918af7a6c4
commit
95e403575a
1 changed files with 8 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue