invar-cli 1.0.0

The Unchanging Key for Changing Data - Generate immutable structural state roots for cryptographic cache keys
# Build stage
FROM rust:slim-bookworm AS builder

WORKDIR /build

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

# Copy everything and build
COPY Cargo.toml Cargo.lock ./
COPY src ./src

# Build the release binary
RUN cargo build --release --locked

# Verify the binary works
RUN ./target/release/invar --version

# Runtime stage - minimal image
FROM debian:bookworm-slim

# Install CA certificates for HTTPS support (if needed in future)
RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Create non-root user
RUN useradd -m -u 1000 invar

# Copy binary from builder
COPY --from=builder /build/target/release/invar /usr/local/bin/invar

# Ensure binary is executable
RUN chmod +x /usr/local/bin/invar

# Switch to non-root user
USER invar
WORKDIR /data

# Default entrypoint
ENTRYPOINT ["invar"]
CMD ["--help"]