mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2024-11-30 13:01:12 +00:00
Update Dockerfile.
This commit is contained in:
parent
5239345c7d
commit
4c54c11adc
1 changed files with 5 additions and 9 deletions
14
Dockerfile
14
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
|
WORKDIR /app
|
||||||
|
|
||||||
|
FROM chef as planner
|
||||||
COPY . .
|
COPY . .
|
||||||
# Compute a lock-like file for our project
|
# Compute a lock-like file for our project
|
||||||
RUN cargo chef prepare --recipe-path recipe.json
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
FROM lukemathwalker/cargo-chef:latest-rust-1.53.0 as cacher
|
FROM chef as builder
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=planner /app/recipe.json recipe.json
|
COPY --from=planner /app/recipe.json recipe.json
|
||||||
# Build our project dependencies, not our application!
|
# Build our project dependencies, not our application!
|
||||||
RUN cargo chef cook --release --recipe-path recipe.json
|
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 . .
|
COPY . .
|
||||||
ENV SQLX_OFFLINE true
|
ENV SQLX_OFFLINE true
|
||||||
|
# Build our project
|
||||||
RUN cargo build --release --bin zero2prod
|
RUN cargo build --release --bin zero2prod
|
||||||
|
|
||||||
FROM debian:buster-slim AS runtime
|
FROM debian:buster-slim AS runtime
|
||||||
|
|
Loading…
Reference in a new issue