Spaces:
Running
Running
Upgrade runtime to Python 3.10 + enable Transformers 5.x support π€
#27
by prithivMLmods - opened
- Dockerfile +46 -56
- requirements.txt +3 -3
Dockerfile
CHANGED
|
@@ -1,10 +1,19 @@
|
|
| 1 |
FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
| 9 |
apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
curl \
|
|
@@ -26,80 +35,61 @@ RUN rm -f /etc/apt/sources.list.d/*.list && \
|
|
| 26 |
software-properties-common \
|
| 27 |
&& rm -rf /var/lib/apt/lists/*
|
| 28 |
|
|
|
|
| 29 |
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
| 30 |
-
apt-get
|
| 31 |
-
apt-get install -y --no-install-recommends nvtop
|
|
|
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
apt-get install -y nodejs && \
|
| 35 |
-
npm install -g configurable-http-proxy
|
|
|
|
| 36 |
|
| 37 |
-
#
|
| 38 |
WORKDIR /app
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
# All users can use /home/user as their home directory
|
| 47 |
-
ENV HOME=/home/user
|
| 48 |
-
RUN mkdir $HOME/.cache $HOME/.config \
|
| 49 |
-
&& chmod -R 777 $HOME
|
| 50 |
-
|
| 51 |
-
# Set up the Conda environment
|
| 52 |
-
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
| 53 |
-
PATH=$HOME/miniconda/bin:$PATH
|
| 54 |
-
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
|
| 55 |
-
&& chmod +x ~/miniconda.sh \
|
| 56 |
-
&& ~/miniconda.sh -b -p ~/miniconda \
|
| 57 |
-
&& rm ~/miniconda.sh \
|
| 58 |
-
&& conda clean -ya
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
-
# Start root user section
|
| 64 |
-
#######################################
|
| 65 |
|
|
|
|
| 66 |
USER root
|
| 67 |
|
| 68 |
-
# User Debian packages
|
| 69 |
-
## Security warning : Potential user code executed as root (build time)
|
| 70 |
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
| 71 |
apt-get update && \
|
| 72 |
-
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
|
| 73 |
-
|
| 74 |
|
| 75 |
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
RUN mkdir /data && chown user:user /data
|
| 79 |
-
|
| 80 |
-
#######################################
|
| 81 |
-
# End root user section
|
| 82 |
-
#######################################
|
| 83 |
|
| 84 |
-
|
| 85 |
|
| 86 |
# Python packages
|
|
|
|
| 87 |
RUN --mount=target=requirements.txt,source=requirements.txt \
|
| 88 |
pip install --no-cache-dir --upgrade -r requirements.txt
|
| 89 |
|
| 90 |
-
#
|
| 91 |
-
COPY --chown=user .
|
| 92 |
-
|
| 93 |
-
RUN chmod +x start_server.sh
|
| 94 |
|
| 95 |
-
|
| 96 |
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
GRADIO_NUM_PORTS=1 \
|
| 100 |
-
GRADIO_SERVER_NAME=0.0.0.0 \
|
| 101 |
-
GRADIO_THEME=huggingface \
|
| 102 |
-
SYSTEM=spaces \
|
| 103 |
-
SHELL=/bin/bash
|
| 104 |
|
| 105 |
CMD ["./start_server.sh"]
|
|
|
|
| 1 |
FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 4 |
+
TZ=Europe/Paris \
|
| 5 |
+
CONDA_AUTO_UPDATE_CONDA=false \
|
| 6 |
+
HOME=/home/user \
|
| 7 |
+
PATH=/home/user/miniconda/bin:$PATH \
|
| 8 |
+
PYTHONUNBUFFERED=1 \
|
| 9 |
+
GRADIO_ALLOW_FLAGGING=never \
|
| 10 |
+
GRADIO_NUM_PORTS=1 \
|
| 11 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
| 12 |
+
GRADIO_THEME=huggingface \
|
| 13 |
+
SYSTEM=spaces \
|
| 14 |
+
SHELL=/bin/bash
|
| 15 |
+
|
| 16 |
+
# Base utilities
|
| 17 |
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
| 18 |
apt-get update && apt-get install -y --no-install-recommends \
|
| 19 |
curl \
|
|
|
|
| 35 |
software-properties-common \
|
| 36 |
&& rm -rf /var/lib/apt/lists/*
|
| 37 |
|
| 38 |
+
# nvtop
|
| 39 |
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
| 40 |
+
apt-get update && \
|
| 41 |
+
apt-get install -y --no-install-recommends nvtop && \
|
| 42 |
+
rm -rf /var/lib/apt/lists/*
|
| 43 |
|
| 44 |
+
# Node.js 21
|
| 45 |
+
RUN curl -fsSL https://deb.nodesource.com/setup_21.x | bash - && \
|
| 46 |
+
apt-get update && \
|
| 47 |
apt-get install -y nodejs && \
|
| 48 |
+
npm install -g configurable-http-proxy && \
|
| 49 |
+
rm -rf /var/lib/apt/lists/*
|
| 50 |
|
| 51 |
+
# Working directory
|
| 52 |
WORKDIR /app
|
| 53 |
|
| 54 |
+
# User setup
|
| 55 |
+
RUN adduser --disabled-password --gecos '' --shell /bin/bash user && \
|
| 56 |
+
mkdir -p /home/user/.cache /home/user/.config /home/user/app && \
|
| 57 |
+
chown -R user:user /home/user /app && \
|
| 58 |
+
echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
+
# Miniconda Python 3.10
|
| 61 |
+
USER user
|
| 62 |
+
RUN curl -fsSL -o /home/user/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-py310_22.11.1-1-Linux-x86_64.sh && \
|
| 63 |
+
bash /home/user/miniconda.sh -b -p /home/user/miniconda && \
|
| 64 |
+
rm -f /home/user/miniconda.sh && \
|
| 65 |
+
conda clean -ya
|
| 66 |
|
| 67 |
+
WORKDIR /home/user/app
|
|
|
|
|
|
|
| 68 |
|
| 69 |
+
# Back to root for system packages / startup
|
| 70 |
USER root
|
| 71 |
|
|
|
|
|
|
|
| 72 |
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
| 73 |
apt-get update && \
|
| 74 |
+
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends && \
|
| 75 |
+
rm -rf /var/lib/apt/lists/*
|
| 76 |
|
| 77 |
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
| 78 |
+
bash /root/on_startup.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
+
RUN mkdir -p /data && chown user:user /data
|
| 81 |
|
| 82 |
# Python packages
|
| 83 |
+
USER user
|
| 84 |
RUN --mount=target=requirements.txt,source=requirements.txt \
|
| 85 |
pip install --no-cache-dir --upgrade -r requirements.txt
|
| 86 |
|
| 87 |
+
# App files
|
| 88 |
+
COPY --chown=user:user . /home/user/app
|
|
|
|
|
|
|
| 89 |
|
| 90 |
+
RUN chmod +x /home/user/app/start_server.sh
|
| 91 |
|
| 92 |
+
# Jupyter template path for Python 3.10
|
| 93 |
+
COPY --chown=user:user login.html /home/user/miniconda/lib/python3.10/site-packages/jupyter_server/templates/login.html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
CMD ["./start_server.sh"]
|
requirements.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
jupyterlab==4.
|
| 2 |
-
tornado==6.
|
| 3 |
-
ipywidgets
|
|
|
|
| 1 |
+
jupyterlab==4.5.6
|
| 2 |
+
tornado==6.5.5
|
| 3 |
+
ipywidgets==8.1.8
|