buster/api/Dockerfile

28 lines
634 B
Docker
Raw Normal View History

2025-01-04 05:32:54 +08:00
FROM lukemathwalker/cargo-chef AS chef
WORKDIR /app
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 . .
RUN cargo build --release --bin bi_api
FROM debian:bookworm-slim AS runtime
WORKDIR /app
RUN apt-get update && apt-get install -y \
ca-certificates \
openssh-client \
curl \
unzip \
libpq5 \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/bi_api .
EXPOSE 3001
ENTRYPOINT ["./bi_api"]