0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 21:49:51 +01:00
posthog/rust/Dockerfile
Oliver Browne 9734a40c96
feat: cyclotron (#24228)
Co-authored-by: Brett Hoerner <brett@bretthoerner.com>
Co-authored-by: Ben White <ben@posthog.com>
2024-08-21 12:24:56 -06:00

39 lines
851 B
Docker

FROM docker.io/lukemathwalker/cargo-chef:latest-rust-1.80.1-bookworm AS chef
ARG BIN
WORKDIR /app
FROM chef AS planner
ARG BIN
COPY . .
RUN cargo chef prepare --recipe-path recipe.json --bin $BIN
FROM chef AS builder
ARG BIN
# Ensure working C compile setup (not installed by default in arm64 images)
RUN apt update && apt install build-essential cmake -y
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release --bin $BIN
FROM debian:bookworm-slim AS runtime
RUN apt-get update && \
apt-get install -y --no-install-recommends \
"ca-certificates" \
&& \
rm -rf /var/lib/apt/lists/*
ARG BIN
ENV BIN=$BIN
WORKDIR /app
USER nobody
COPY --from=builder /app/target/release/$BIN /usr/local/bin
ENTRYPOINT ["/bin/sh", "-c", "/usr/local/bin/$BIN"]