Scalable and distributed custom feed generator, ott - on that topic
1FROM rust:1 AS chef
2# We only pay the installation cost once,
3# it will be cached from the second build onwards
4RUN cargo install cargo-chef
5WORKDIR /workspace
6
7FROM chef AS planner
8COPY crates .
9RUN cargo chef prepare --recipe-path recipe.json
10
11FROM chef AS builder
12ARG CRATE_NAME
13COPY --from=planner /workspace/recipe.json recipe.json
14# Build dependencies - this is the caching Docker layer!
15RUN cargo chef cook --release --recipe-path recipe.json
16# Build application
17COPY crates .
18RUN cargo build --release --bin ${CRATE_NAME}
19
20FROM debian:trixie-slim AS runtime
21ARG CRATE_NAME
22# Gah, time in my docker vm is wrong
23RUN apt-get update -o Acquire::Max-FutureTime=31536000 --allow-insecure-repositories --allow-releaseinfo-change-suite &&\
24 apt-get install -y postgresql-client && \
25 apt-get clean && \
26 rm -rf /var/lib/apt/lists/*
27COPY --from=builder /workspace/target/release/${CRATE_NAME} app