FROM rust:1.94-bookworm AS builder
RUN apt-get update \
    && apt-get install -y --no-install-recommends libclang-dev protobuf-compiler \
    && rm -rf /var/lib/apt/lists/*
RUN rustup component add rustfmt
WORKDIR /build
COPY . .
RUN cargo build --release && \
    cp target/release/pg_propre /pg_propre

FROM debian:bookworm-slim
COPY --from=builder /pg_propre /usr/local/bin/pg_propre
ENTRYPOINT ["pg_propre"]
