From c4c53d57c0c5f6406e4c47a0001d189a649a2408 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Sun, 24 Mar 2024 21:13:13 +0200 Subject: [PATCH] chore(docker): add chef --- Dockerfile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index bd556cc..bd8366c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,23 @@ -FROM rust:1.77.0 AS builder - +FROM lukemathwalker/cargo-chef:latest-rust-1.77.0 AS chef WORKDIR /app +COPY . . RUN apt-get update && apt-get install lld clang -y + +FROM chef as planner +COPY . . +RUN cargo chef prepare --recipe-path recipe.json + +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 - FROM debian:bookworm-slim AS runtime WORKDIR /app -# Install OpenSSL - it is dynamically linked by some of our dependencies -# Install ca-certificates - it is needed to verify TLS certificates when establishing HTTPS connections +# openssl - it is dynamically linked by some dependencies +# ca-certificates - it is needed to verify TLS certificates when establishing HTTPS connections RUN apt-get update -y \ && apt-get install -y --no-install-recommends openssl ca-certificates \ # Clean up