mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2025-01-22 06:48:06 +00:00
Update Dockerfile to use pre-baked image.
This commit is contained in:
parent
79bb585439
commit
a2eb4c63c5
1 changed files with 3 additions and 9 deletions
12
Dockerfile
12
Dockerfile
|
@ -1,22 +1,16 @@
|
||||||
FROM rust:1.47 AS planner
|
FROM lukemathwalker/cargo-chef as planner
|
||||||
WORKDIR app
|
WORKDIR app
|
||||||
# We only pay the installation cost once,
|
|
||||||
# it will be cached from the second build onwards
|
|
||||||
# To ensure a reproducible build consider pinning
|
|
||||||
# the cargo-chef version with `--version X.X.X`
|
|
||||||
RUN cargo install cargo-chef
|
|
||||||
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 rust:1.47 AS cacher
|
FROM lukemathwalker/cargo-chef as planner
|
||||||
WORKDIR app
|
WORKDIR app
|
||||||
RUN cargo install cargo-chef
|
|
||||||
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.47 AS builder
|
FROM rust:1.50 AS builder
|
||||||
WORKDIR app
|
WORKDIR app
|
||||||
# Copy over the cached dependencies
|
# Copy over the cached dependencies
|
||||||
COPY --from=cacher /app/target target
|
COPY --from=cacher /app/target target
|
||||||
|
|
Loading…
Reference in a new issue