# OomLlama - Efficient LLM Inference Engine
# Multi-stage build for minimal final image

# Stage 1: Build Rust binary
FROM rust:latest AS builder

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

WORKDIR /app

# Copy workspace files
COPY Cargo.toml Cargo.lock ./
COPY src/ ./src/

# Build release binaries (oomllama + gguf2oom)
RUN cargo build --release --bin oomllama --bin gguf2oom

# Stage 2: Minimal runtime image
FROM debian:bookworm-slim

# Install runtime dependencies
RUN apt-get update && apt-get install -y \
    ca-certificates \
    libssl3 \
    && rm -rf /var/lib/apt/lists/*

# Copy binaries from builder
COPY --from=builder /app/target/release/oomllama /usr/local/bin/
COPY --from=builder /app/target/release/gguf2oom /usr/local/bin/

# Create model directory
RUN mkdir -p /models

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

# Labels
LABEL org.opencontainers.image.title="OomLlama"
LABEL org.opencontainers.image.description="Efficient LLM inference with .oom format - 2x smaller than GGUF"
LABEL org.opencontainers.image.vendor="HumoticaOS"
LABEL org.opencontainers.image.source="https://github.com/jaspertvdm/Backend-server-JTel"
LABEL org.opencontainers.image.version="0.2.0"
