Files
book_bot/docker/build.dockerfile
2022-09-14 19:48:23 +03:00

31 lines
723 B
Docker

FROM lukemathwalker/cargo-chef:latest-rust-slim-buster AS chef
WORKDIR /app
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
RUN apt-get update \
&& apt-get install -y pkg-config libssl-dev \
&& rm -rf /var/lib/apt/lists/*
COPY --from=planner /app/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release --bin book_bot
FROM debian:bullseye-slim
RUN apt-get update \
&& apt-get install -y openssl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN update-ca-certificates
WORKDIR /app
COPY --from=builder /app/target/release/book_bot /usr/local/bin
ENTRYPOINT ["/usr/local/bin/book_bot"]