backendprocessmath / Dockerfile
sreepathi-ravikumar's picture
Create Dockerfile
5c752cb verified
FROM python:3.11-slim
# Install system dependencies for Manim
RUN apt-get update -qq && apt-get install --no-install-recommends -y \
build-essential \
gcc \
cmake \
libcairo2-dev \
libffi-dev \
libpango1.0-dev \
freeglut3-dev \
ffmpeg \
pkg-config \
make \
wget \
ghostscript \
fonts-noto \
tesseract-ocr \
tesseract-ocr-tam \
fonts-liberation \
curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN fc-cache -fv
# Setup minimal texlive installation for mathematical rendering
ENV PATH=/usr/local/texlive/bin/armhf-linux:/usr/local/texlive/bin/aarch64-linux:/usr/local/texlive/bin/x86_64-linux:$PATH
COPY texlive-profile.txt /tmp/
RUN wget -O /tmp/install-tl-unx.tar.gz http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz && \
mkdir /tmp/install-tl && \
tar -xzf /tmp/install-tl-unx.tar.gz -C /tmp/install-tl --strip-components=1 && \
/tmp/install-tl/install-tl --profile=/tmp/texlive-profile.txt && \
tlmgr install \
amsmath babel-english cbfonts-fd cm-super count1to ctex doublestroke dvisvgm everysel \
fontspec frcursive fundus-calligra gnu-freefont jknapltx latex-bin \
mathastext microtype multitoc physics prelim2e preview ragged2e relsize rsfs \
setspace standalone tipa wasy wasysym xcolor xetex xkeyval && \
rm -rf /tmp/install-tl*
# Create app user
ARG NB_USER=appuser
ARG NB_UID=1000
ENV USER=${NB_USER}
ENV NB_UID=${NB_UID}
ENV HOME=/app
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
WORKDIR ${HOME}
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY --chown=appuser:appuser . .
# Create output directory
RUN mkdir -p /app/media /app/temp && \
chown -R ${NB_USER}:${NB_USER} /app && \
chmod -R 777 /app/media /app/temp
USER ${NB_USER}
EXPOSE 7860
CMD ["python", "app.py"]