FROM rust:latest as builder

WORKDIR /usr/src/void-sentinel
COPY . .
RUN cargo build --release --bin void-sentinel
RUN strip target/release/void-sentinel -o /usr/local/bin/void-sentinel

FROM debian:bookworm-slim
RUN apt-get update &&     apt-get install -y ca-certificates tzdata &&     rm -rf /var/lib/apt/lists/*

COPY --from=builder /usr/local/bin/void-sentinel /usr/local/bin/void-sentinel

RUN groupadd -g 1001 appgroup &&     useradd -u 1001 -g appgroup -s /bin/false -m appuser

USER appuser
WORKDIR /app

CMD ["/usr/local/bin/void-sentinel"]

