# Papernews — Dockerfile
# Python 3.12 slim + a minimal LaTeX install for newspaper PDF generation.
# texlive-latex-extra adds titlesec, microtype, and other layout packages.
# Image is large (~700MB) due to texlive — this is expected and a one-time cost.
#
# Rebuild after code changes: docker compose up -d --build

FROM python:3.12-slim

# Install LaTeX. --no-install-recommends keeps the layer as lean as possible.
RUN apt-get update && apt-get install -y --no-install-recommends \
    texlive-latex-base \
    texlive-latex-recommended \
    texlive-fonts-recommended \
    texlive-latex-extra \
    lmodern \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install Python deps first (layer-cached until requirements.txt changes)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY papernews.py .

# /output is mounted from the host — PDFs are written and pruned here
VOLUME ["/output"]

CMD ["python", "papernews.py"]
