# Custom docker image for DeTikZify. The default HF Spaces GPU image installs a # tex live version that is too old for our needs, so we install the correct one # ourselves. ## system setup # ----------------------------------------------------------------------------- FROM nvcr.io/nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04 ARG DEBIAN_FRONTEND=noninteractive Run apt update && apt install -y \ ghostscript \ poppler-utils \ git \ make \ build-essential \ libssl-dev \ zlib1g-dev \ libbz2-dev \ libreadline-dev \ libsqlite3-dev \ wget \ curl \ llvm \ libncursesw5-dev \ xz-utils \ tk-dev \ libxml2-dev \ libxmlsec1-dev \ libffi-dev \ liblzma-dev \ ffmpeg \ libsm6 \ libxext6 \ cmake \ libgl1-mesa-glx \ sudo # install tex live 2023 ENV PATH=/opt/texbin:$PATH RUN curl -LO https://github.com/scottkosty/install-tl-ubuntu/raw/master/install-tl-ubuntu \ && chmod +x ./install-tl-ubuntu \ && ./install-tl-ubuntu --repository 'https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2023/tlnet-final'\ && rm ./install-tl-ubuntu ## setup user # ----------------------------------------------------------------------------- RUN useradd -m -G users -u 1000 user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app ## install python dependencies # ----------------------------------------------------------------------------- # install pyenv ENV PYENV_ROOT=/opt/pyenv ENV PATH=$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH RUN curl https://pyenv.run | bash \ && chown -R root:users $PYENV_ROOT \ && chmod -R g+w $PYENV_ROOT RUN pyenv install 3.11 \ && pyenv global 3.11 \ && pyenv rehash \ && pip install --no-cache-dir --upgrade setuptools wheel \ && pip install --no-cache-dir 'detikzify @ git+https://github.com/potamides/DeTikZify' \ && pip install --no-cache-dir flash-attn --no-build-isolation \ && pip install --no-cache-dir spaces RUN chown -R user $HOME/app COPY --chown=user . $HOME/app ## launch app # ----------------------------------------------------------------------------- USER user CMD ["python", "app.py"]