Bumps the base image in Dockerfile/Dockerfile.ci (via Renovate #158) and keeps rust-toolchain.toml in sync, since rustup honors the toolchain file inside the container build and would otherwise keep using 1.95.0. Verified locally under 1.96.0: cargo check, clippy -D warnings, fmt check, and cargo test --all-features all pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
55 lines
1.3 KiB
Docker
55 lines
1.3 KiB
Docker
#######################################
|
|
# #
|
|
# Stage 1: building #
|
|
# #
|
|
#######################################
|
|
|
|
FROM docker.io/rust:1.96.0-slim-trixie 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
|
|
|
|
ARG RELEASE_BUILD=true
|
|
|
|
RUN --mount=type=cache,target=/cargo,sharing=locked \
|
|
--mount=type=cache,target=/target,sharing=locked \
|
|
if [ "$RELEASE_BUILD" = "true" ]; then \
|
|
cargo build --release; \
|
|
else \
|
|
cargo build; \
|
|
fi
|
|
|
|
# Move it out of the mounted cache, so we can copy it in the next stage.
|
|
RUN --mount=type=cache,target=/target,sharing=locked \
|
|
if [ "$RELEASE_BUILD" = "true" ]; then \
|
|
cp /target/release/baibot /baibot; \
|
|
else \
|
|
cp /target/debug/baibot /baibot; \
|
|
fi
|
|
|
|
#######################################
|
|
# #
|
|
# Stage 2: packaging #
|
|
# #
|
|
#######################################
|
|
|
|
FROM docker.io/debian:trixie-slim
|
|
|
|
RUN apt-get update && apt-get install -y ca-certificates sqlite3 && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=build /baibot .
|
|
|
|
ENTRYPOINT ["/bin/sh", "-c"]
|
|
|
|
CMD ["/app/baibot"]
|