Skip to content

Commit

Permalink
use non-caching dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Giesch committed Apr 27, 2021
1 parent 05eecca commit 755ae56
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions Dockerfile
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"]

0 comments on commit 755ae56

Please sign in to comment.