Scalable and distributed custom feed generator, ott - on that topic
1FROM rust:1 AS chef
2RUN cargo install cargo-chef
3WORKDIR /workspace
4
5
6FROM chef AS planner
7COPY crates .
8RUN cargo chef prepare --recipe-path recipe.json
9
10FROM chef AS builder
11COPY --from=planner /workspace/recipe.json recipe.json
12# Build dependencies - this is the caching Docker layer!
13COPY crates/Cargo.* .
14COPY crates/**/Cargo.toml .
15RUN cargo chef cook --release --recipe-path recipe.json
16# Build application
17COPY crates .
18ARG CRATE_NAME
19RUN cargo build --release --bin ${CRATE_NAME}
20
21FROM debian:trixie-slim AS runtime
22RUN apt-get update &&\
23 apt-get install -y ca-certificates &&\
24 rm -rf /var/lib/apt/lists/*
25
26ARG CRATE_NAME
27ENV USER=${CRATE_NAME}
28RUN useradd \
29 --create-home \
30 --home-dir "/home/$USER" \
31 --shell /bin/bash \
32 "$USER"
33USER $USER
34WORKDIR /home/${CRATE_NAME}
35COPY ./connectors/fluvio_profile.toml /home/${CRATE_NAME}/.fluvio/config
36COPY --from=builder /workspace/target/release/${CRATE_NAME} /usr/local/bin/app
37ENTRYPOINT ["/usr/local/bin/app"]