CHEFerise docker app to make it more efficient

This commit is contained in:
Nick Bland
2021-11-16 15:50:00 +10:00
parent 0a31ae482b
commit e2c83c817b
2 changed files with 13 additions and 4 deletions
+12 -3
View File
@@ -1,8 +1,17 @@
FROM rust:1.56-slim AS builder
FROM lukemathwalker/cargo-chef:latest-rust-1.53.0 AS chef
WORKDIR /app
COPY . .
# Create lock file for project to be used in builder
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
# Build dependancies
FROM chef as builder
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
ENV SQLX_OFFLINE true
RUN cargo build --release