chore(docker): add chef

This commit is contained in:
Kristofers Solo 2024-03-24 21:13:13 +02:00
parent 84d9656418
commit c4c53d57c0

View File

@ -1,16 +1,23 @@
FROM rust:1.77.0 AS builder FROM lukemathwalker/cargo-chef:latest-rust-1.77.0 AS chef
WORKDIR /app WORKDIR /app
COPY . .
RUN apt-get update && apt-get install lld clang -y 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 . . COPY . .
ENV SQLX_OFFLINE true ENV SQLX_OFFLINE true
RUN cargo build --release RUN cargo build --release
FROM debian:bookworm-slim AS runtime FROM debian:bookworm-slim AS runtime
WORKDIR /app WORKDIR /app
# Install OpenSSL - it is dynamically linked by some of our dependencies # openssl - it is dynamically linked by some dependencies
# Install ca-certificates - it is needed to verify TLS certificates when establishing HTTPS connections # ca-certificates - it is needed to verify TLS certificates when establishing HTTPS connections
RUN apt-get update -y \ RUN apt-get update -y \
&& apt-get install -y --no-install-recommends openssl ca-certificates \ && apt-get install -y --no-install-recommends openssl ca-certificates \
# Clean up # Clean up