# Job image for the "latex" Gitea runner label (see .gitea/workflows/manual.yml).
#
# Base: official TeX Live image. It already includes Python + Pygments, which
# the minted package needs. A fixed release tag is used instead of "latest" so
# builds are reproducible; record the resolved digest in the manual.
FROM texlive/texlive:TL2025-historic

# The workflow's actions (checkout, upload-artifact) are JavaScript actions and
# need Node.js inside the job container; git lets checkout do a real clone.
# Packages come from the image's own Debian repositories -- no downloaded scripts.

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
       nodejs git ca-certificates python3 python3-pip python3-venv curl \
    && python3 -m venv /opt/latex-venv \
    && /opt/latex-venv/bin/pip install --upgrade pip \
    && /opt/latex-venv/bin/pip install --upgrade latexminted==0.7.1 Pygments \
    && mkdir -p /tmp/minted-src /usr/local/share/texmf/tex/latex/minted \
    && curl -fsSL https://mirrors.ctan.org/macros/latex/contrib/minted/minted.dtx \
       -o /tmp/minted-src/minted.dtx \
    && curl -fsSL https://mirrors.ctan.org/macros/latex/contrib/minted/minted.ins \
       -o /tmp/minted-src/minted.ins \
    && cd /tmp/minted-src \
    && latex minted.ins \
    && cp minted.sty /usr/local/texlive/2025/texmf-dist/tex/latex/minted/minted.sty \
    && mktexlsr \
    && rm -rf /tmp/minted-src \
    && mktexlsr \
    && rm -rf /var/lib/apt/lists/*

ENV PATH="/opt/latex-venv/bin:/usr/local/bin:${PATH}"