AutomaTikZ / Dockerfile
potamides's picture
Update Dockerfile
447cf4d verified
raw
history blame
2.84 kB
# Custom docker image for AutomaTikZ, based on the default HF Spaces GPU image.
# The default image installs a tex live version that is too old for our needs,
# so we install the latest one oureselves. The modifications stay close to the
# source image, so, should the official image be updated to a newer ubuntu
# version, it could be changed back to a gradio space without much effort.
## system setup
# -----------------------------------------------------------------------------
FROM docker.io/nvidia/cuda:11.7.1-cudnn8-devel-ubuntu22.04@sha256:69cd988555eabe116f76acc754b363eee75f37674c23adb2b523f5fa32543984
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
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
## setup user
# -----------------------------------------------------------------------------
RUN useradd -m -G users -u 1000 user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
## custom dependencies
# -----------------------------------------------------------------------------
# Install an up-to-date tex live version
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
RUN --mount=target=/root/packages.txt,source=packages.txt \
apt-get update \
&& sed '/texlive*/d' /root/packages.txt \
| xargs -r apt-get install -y \
&& rm -rf /var/lib/apt/lists/*
# 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.10 \
&& pyenv global 3.10 \
&& pyenv rehash \
&& pip install --no-cache-dir --upgrade pip==22.3.1 setuptools wheel \
&& pip install --no-cache-dir datasets "huggingface-hub>=0.12.1" "protobuf<4" "click<8.1" "pydantic~=1.0"
RUN --mount=target=requirements.txt,source=requirements.txt \
pip install --no-cache-dir -r requirements.txt
#RUN --mount=target=pre-requirements.txt,source=pre-requirements.txt \
# pip install --no-cache-dir -r pre-requirements.txt
RUN pip install --no-cache-dir gradio[oauth]==3.47.1 uvicorn>=0.14.0 spaces==0.16.1
RUN chown -R user $HOME/app
COPY --chown=user . $HOME/app
## launch app
# -----------------------------------------------------------------------------
USER user
CMD ["python", "app.py"]