1- FROM python:3.11-slim
1+ # ── Stage 1: builder ─────────────────────────────────────────────────────────
2+ FROM python:3.14-slim AS builder
23
34RUN apt-get update -qq \
45 && apt-get install --no-install-recommends -y \
56 build-essential \
67 gcc \
78 cmake \
9+ make \
10+ pkg-config \
11+ wget \
812 libcairo2-dev \
913 libffi-dev \
1014 libpango1.0-dev \
11- freeglut3-dev \
12- ffmpeg \
13- pkg-config \
14- make \
15- wget \
16- ghostscript \
17- fonts-noto
15+ libegl-dev \
16+ && rm -rf /var/lib/apt/lists/*
1817
19- RUN fc-cache -fv
20-
21- # setup a minimal texlive installation
18+ # Setup a minimal TeX Live installation (no ctex: drops ~100 MB of CJK fonts/packages)
2219COPY docker/texlive-profile.txt /tmp/
2320ENV PATH=/usr/local/texlive/bin/armhf-linux:/usr/local/texlive/bin/aarch64-linux:/usr/local/texlive/bin/x86_64-linux:$PATH
24- RUN wget -O /tmp/install-tl-unx.tar.gz http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz && \
25- mkdir /tmp/install-tl && \
26- tar -xzf /tmp/install-tl-unx.tar.gz -C /tmp/install-tl --strip-components=1 && \
27- /tmp/install-tl/install-tl --profile=/tmp/texlive-profile.txt \
21+ RUN wget -O /tmp/install-tl-unx.tar.gz http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz \
22+ && mkdir /tmp/install-tl \
23+ && tar -xzf /tmp/install-tl-unx.tar.gz -C /tmp/install-tl --strip-components=1 \
24+ && /tmp/install-tl/install-tl --profile=/tmp/texlive-profile.txt \
2825 && tlmgr install \
29- amsmath babel-english cbfonts-fd cm-super count1to ctex doublestroke dvisvgm everysel \
26+ amsmath babel-english cbfonts-fd cm-super count1to doublestroke dvisvgm everysel \
3027 fontspec frcursive fundus-calligra gnu-freefont jknapltx latex-bin \
3128 mathastext microtype multitoc physics prelim2e preview ragged2e relsize rsfs \
32- setspace standalone tipa wasy wasysym xcolor xetex xkeyval
29+ setspace standalone tipa wasy wasysym xcolor xetex xkeyval \
30+ && rm -rf /tmp/install-tl /tmp/install-tl-unx.tar.gz
31+
32+ # Install manim into an isolated virtualenv
33+ ENV VIRTUAL_ENV=/opt/venv
34+ RUN python -m venv $VIRTUAL_ENV
35+ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
3336
34- # clone and build manim
3537COPY . /opt/manim
3638WORKDIR /opt/manim
37- RUN pip install --no-cache .[jupyterlab]
39+ RUN pip install --no-cache-dir .[jupyterlab]
40+
41+ # ── Stage 2: runtime ─────────────────────────────────────────────────────────
42+ FROM python:3.14-slim
43+
44+ # Runtime libs only:
45+ # - no ffmpeg: PyAV (av package) bundles its own ffmpeg libraries in av.libs/
46+ # - OpenGL: keep EGL for headless rendering and libGL as required by moderngl/glcontext
47+ # - fonts-noto-core instead of fonts-noto (drops CJK noto fonts)
48+ RUN apt-get update -qq \
49+ && apt-get install --no-install-recommends -y \
50+ libcairo2 \
51+ libpango-1.0-0 \
52+ libpangocairo-1.0-0 \
53+ libpangoft2-1.0-0 \
54+ libffi8 \
55+ libegl1 \
56+ libgl1 \
57+ ghostscript \
58+ fonts-noto-core \
59+ fontconfig \
60+ && rm -rf /var/lib/apt/lists/*
61+
62+ RUN fc-cache -fv
63+
64+ # Copy TeX Live from builder
65+ ENV PATH=/usr/local/texlive/bin/armhf-linux:/usr/local/texlive/bin/aarch64-linux:/usr/local/texlive/bin/x86_64-linux:$PATH
66+ COPY --from=builder /usr/local/texlive /usr/local/texlive
3867
39- RUN pip install -r docs/requirements.txt
68+ # Copy the pre-built virtualenv from builder
69+ ENV VIRTUAL_ENV=/opt/venv
70+ COPY --from=builder /opt/venv /opt/venv
71+ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
4072
4173ARG NB_USER=manimuser
4274ARG NB_UID=1000
@@ -49,11 +81,8 @@ RUN adduser --disabled-password \
4981 --uid ${NB_UID} \
5082 ${NB_USER}
5183
52- # create working directory for user to mount local directory into
5384WORKDIR ${HOME}
54- USER root
55- RUN chown -R ${NB_USER}:${NB_USER} ${HOME}
56- RUN chmod 777 ${HOME}
85+ RUN chown -R ${NB_USER}:${NB_USER} ${HOME} && chmod 777 ${HOME}
5786USER ${NB_USER}
5887
59- CMD [ "/bin/bash" ]
88+ CMD ["/bin/bash" ]
0 commit comments