-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
6 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,17 @@ | ||
FROM rust:1.47 AS planner | ||
FROM rust:1.50 AS builder | ||
WORKDIR app | ||
RUN cargo install cargo-chef --version 0.1.6 | ||
COPY . . | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM rust:1.47 AS cacher | ||
WORKDIR app | ||
RUN cargo install cargo-chef --version 0.1.6 | ||
COPY --from=planner /app/recipe.json recipe.json | ||
RUN RUST_BACKTRACE=1 cargo chef cook --release --recipe-path recipe.json | ||
|
||
FROM rust:1.47 AS builder | ||
WORKDIR app | ||
COPY --from=cacher /app/target target | ||
COPY --from=cacher /usr/local/cargo /usr/local/cargo | ||
COPY . . | ||
ENV SQLX_OFFLINE true | ||
RUN cargo build --release --bin zero2prod | ||
|
||
FROM debian:buster-slim AS runtime | ||
WORKDIR app | ||
# OpenSSL is dynamically linked by some dependencies | ||
RUN apt-get update -y \ | ||
&& apt-get install -y --no-install-recommends openssl \ | ||
# Cleanup | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
RUN apt-get update -y | ||
&& apt-get install -y --no-install-recommends openssl | ||
&& apt-get autoremove -y | ||
&& apt-get clean -y | ||
&& rm -rf /var/lib/apt/lists/* | ||
COPY --from=builder /app/target/release/zero2prod ./zero2prod | ||
COPY --from=builder /app/target/release/zero2prod zero2prod | ||
COPY configuration configuration | ||
ENV APP_ENVIRONMENT production | ||
ENTRYPOINT ["./zero2prod"] |