# Build stage
FROM rust:1.91-trixie AS builder

WORKDIR /app

# Install build dependencies
RUN set -e && \
    apt-get update && \
    apt-get install -y pkg-config && \
    rm -rf /var/lib/apt/lists/*

# Copy source code
COPY . .

# Build release binary
RUN set -e && cargo build --release || (echo "ERROR: Cargo build failed" && exit 1)

# Runtime stage
FROM debian:trixie-slim AS runtime

# Install ca-certificates for HTTPS
RUN set -e && \
    apt-get update && \
    apt-get install -y ca-certificates && \
    rm -rf /var/lib/apt/lists/*

# Copy the binary from builder
COPY --from=builder /app/target/release/brib /usr/local/bin/brib

# Expose the port for Slack webhooks
EXPOSE 3000

# Run the binary
CMD ["brib"]

#
# end of file
#
