FROM debian:bookworm

ENV DEBIAN_FRONTEND=noninteractive \
    PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

RUN apt-get update \
    && apt-get install --yes --no-install-recommends \
        python3 \
        python3-venv \
        gosu \
        pandoc \
        texlive-full \
    && fc-cache -f \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY watch_and_convert.py entrypoint.sh ./

RUN chmod +x /app/entrypoint.sh /app/watch_and_convert.py

ENV PUID=1000 \
    PGID=1000

ENTRYPOINT ["/app/entrypoint.sh"]
