FROM rust:1.93 AS builder RUN rustup target add x86_64-unknown-linux-musl RUN apt-get update && apt-get install -y musl-tools && rm -rf /var/lib/apt/lists/* WORKDIR /usr/src/app COPY ./Cargo.toml ./Cargo.lock ./ COPY ./src ./src RUN cargo build --release --target x86_64-unknown-linux-musl # Runtime image with postgresql-client tooling available FROM debian:bookworm-slim RUN apt-get update && \ apt-get install -y --no-install-recommends postgresql-client ca-certificates && \ rm -rf /var/lib/apt/lists/* COPY --from=builder /usr/src/app/target/x86_64-unknown-linux-musl/release/pg-instance-handler /usr/local/bin/pg-instance-handler WORKDIR / ENTRYPOINT ["/usr/local/bin/pg-instance-handler"]