mirror of
https://github.com/UiO-Gaming/mustafa.git
synced 2026-11-05 13:56:48 +01:00
Draw text that users write with Noto Sans CJK Bold so Chinese, Japanese, Korean, Cyrillic and Greek no longer show up as boxes. It replaces DejaVu Sans and Impact, and Comic Sans everywhere but the CS2 bingo. The Dockerfile makes the font available to Graphviz for /mbti. put_text_in_box now finds the largest font size where the text, wrapped to the box's pixel width, fits, and centers the drawn text. Long texts used to overflow and single letters were pushed out of their box. Words are only split when keeping them whole would halve the size. Long crab rave texts shrink to fit the video instead of going past its edges, and the divider line is a bit longer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
672 B
Docker
27 lines
672 B
Docker
FROM python:3.14
|
|
|
|
COPY --from=ghcr.io/astral-sh/uv:0.13.5 /uv /uvx /bin/
|
|
|
|
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_PYTHON_DOWNLOADS=never
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y ffmpeg graphviz pandoc
|
|
|
|
COPY pyproject.toml uv.lock .python-version ./
|
|
|
|
RUN uv sync --locked --no-dev --no-cache
|
|
|
|
RUN .venv/bin/python -m nltk.downloader -d /usr/local/share/nltk_data stopwords
|
|
|
|
COPY . .
|
|
|
|
# Let Graphviz find the bundled font for text in other scripts, like CJK
|
|
RUN mkdir -p /usr/local/share/fonts && ln -s /app/src/assets/fonts/NotoSansCJK-Bold.ttc /usr/local/share/fonts/
|
|
|
|
ENV PATH="/app/.venv/bin:$PATH"
|
|
|
|
VOLUME /app/logs
|
|
|
|
CMD ["python3", "src/run.py"]
|