FROM python:3.14-slim

COPY --from=ghcr.io/astral-sh/uv:0.9.21 /uv /uvx /bin/

RUN apt-get update && apt-get install -y --no-install-recommends \
  texlive-xetex \
  texlive-lang-cyrillic \
  texlive-latex-extra \
  fonts-liberation \
  cabextract \
  wget \
  fontconfig \
  && rm -rf /var/lib/apt/lists/*

RUN cd /tmp && \
  wget -q https://downloads.sourceforge.net/corefonts/times32.exe && \
  cabextract times32.exe && \
  mkdir -p /usr/share/fonts/truetype/msttcorefonts && \
  cp -f *.TTF /usr/share/fonts/truetype/msttcorefonts/ && \
  fc-cache -f && \
  rm -f /tmp/*.TTF /tmp/times32.exe

WORKDIR /build
COPY . .
RUN uv pip install --system --no-cache .

ENV UV_CACHE_DIR=/tmp/uv-cache
ENTRYPOINT ["md2gost"]
