Files
baibot-withmcp/Dockerfile
Slavi Pantaleev 946aa9d9e9 Initial commit
2024-09-12 13:44:06 +03:00

44 lines
1.1 KiB
Docker

#######################################
# #
# Stage 1: building #
# #
#######################################
FROM docker.io/rust:1.80.1-slim-bookworm AS build
RUN apt-get update && apt-get install -y build-essential pkg-config libssl-dev libsqlite3-dev
ENV CARGO_HOME=/cargo
ENV CARGO_TARGET_DIR=/target
WORKDIR /app
COPY . /app
RUN --mount=type=cache,target=/cargo,sharing=locked \
--mount=type=cache,target=/target,sharing=locked \
cargo build --release
# Move it out of the mounted cache, so we can copy it in the next stage.
RUN --mount=type=cache,target=/target,sharing=locked \
cp /target/release/baibot /baibot
#######################################
# #
# Stage 2: packaging #
# #
#######################################
FROM docker.io/debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates sqlite3
WORKDIR /app
COPY --from=build /baibot .
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["/app/baibot"]