# Dockerfile — Python runner for the Day-4 AI-assisted triage + IR runbook lab
# Base image pinned by index-digest (ADR-6).
# Re-resolve: docker buildx imagetools inspect python:3.12-slim --format '{{.Manifest.Digest}}'
FROM python:3.12-slim@sha256:423ed6ab25b1921a477529254bfeeabf5855151dc2c3141699a1bfc852199fbf

WORKDIR /workspace

# Install system packages:
#   curl — for debugging convenience (e.g. testing Ollama from inside the container)
RUN apt-get update \
    && apt-get install -y --no-install-recommends curl \
    && rm -rf /var/lib/apt/lists/*

# Install Python dependencies (layer-cached unless requirements.txt changes).
# Includes:
#   httpx — HTTP client for Ollama API calls
#   rich  — terminal output formatting
COPY app/requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Bake app + data + prompts into the image so it works standalone.
# Compose volume mounts override these at runtime (edits without rebuild).
COPY app/ ./app/
COPY data/ ./data/
COPY prompts/ ./prompts/

# Default: full triage + runbook flow (interactive human-in-the-loop gate).
# Override at runtime:
#   docker compose run --rm runner python app/triage_ir.py --alert ALERT-2026-0002
CMD ["python", "app/triage_ir.py"]
