FROM rust:1.82.0-slim-bookworm AS build RUN USER=root cargo new --bin matrix-feedbot WORKDIR /matrix-feedbot COPY Cargo.lock ./ COPY Cargo.toml ./ RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev pkg-config # cache dependencies RUN cargo build --release RUN rm src/*.rs COPY src ./src RUN rm target/release/deps/matrix_feedbot* RUN cargo build --release FROM debian:bookworm-slim RUN apt-get update && apt-get install -y --no-install-recommends libssl3 ca-certificates && apt-get clean COPY --from=build /matrix-feedbot/target/release/matrix-feedbot . CMD ["./matrix-feedbot"]