File size: 1,992 Bytes
5c752cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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"]