2024-05-30 02:07:52 +08:00

21 lines
630 B
Docker

FROM rust:bookworm as rust
FROM rust as chef
RUN apt update && apt install -y build-essential && cargo install --locked cargo-chef
WORKDIR /app
FROM chef as planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
RUN apt install -y libprotobuf-dev protobuf-compiler
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release --package chat-signaling-server --bin server
FROM debian:bookworm AS runtime
WORKDIR /app
COPY --from=builder /app/target/release/server /usr/local/bin
ENTRYPOINT ["/usr/local/bin/server"]