Spaces:
Running
on
A100
Running
on
A100
Merge remote-tracking branch 'origin/main'
Browse files- Dockerfile +5 -62
Dockerfile
CHANGED
|
@@ -1,51 +1,8 @@
|
|
| 1 |
# Start from the TGI base image
|
| 2 |
FROM ghcr.io/huggingface/text-generation-inference:2.0 as base
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
-
#RUN pip install -r /code/requirements.txt
|
| 7 |
-
#RUN pip install jupyterlab jupyterlab-vim==0.15.1 jupyterlab-vimrc
|
| 8 |
-
|
| 9 |
-
# Remove any third-party apt sources to avoid issues with expiring keys.
|
| 10 |
-
# Install some basic utilities
|
| 11 |
-
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
| 12 |
-
apt-get update && apt-get install -y --no-install-recommends \
|
| 13 |
-
curl \
|
| 14 |
-
ca-certificates \
|
| 15 |
-
sudo \
|
| 16 |
-
git \
|
| 17 |
-
git-lfs \
|
| 18 |
-
zip \
|
| 19 |
-
unzip \
|
| 20 |
-
htop \
|
| 21 |
-
bzip2 \
|
| 22 |
-
libx11-6 \
|
| 23 |
-
build-essential \
|
| 24 |
-
libsndfile-dev \
|
| 25 |
-
software-properties-common \
|
| 26 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 27 |
-
|
| 28 |
-
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
| 29 |
-
apt-get upgrade -y && \
|
| 30 |
-
apt-get install -y --no-install-recommends nvtop
|
| 31 |
-
|
| 32 |
-
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
| 33 |
-
apt-get install -y nodejs && \
|
| 34 |
-
npm install -g configurable-http-proxy
|
| 35 |
-
|
| 36 |
-
# Create a working directory
|
| 37 |
-
WORKDIR /app
|
| 38 |
-
|
| 39 |
-
# Create a non-root user and switch to it
|
| 40 |
-
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
| 41 |
-
&& chown -R user:user /app
|
| 42 |
-
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
| 43 |
-
USER user
|
| 44 |
-
|
| 45 |
-
# All users can use /home/user as their home directory
|
| 46 |
-
ENV HOME=/home/user
|
| 47 |
-
RUN mkdir $HOME/.cache $HOME/.config \
|
| 48 |
-
&& chmod -R 777 $HOME
|
| 49 |
|
| 50 |
# Set up the Conda environment
|
| 51 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
|
@@ -58,24 +15,10 @@ RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39
|
|
| 58 |
|
| 59 |
WORKDIR $HOME/app
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
#######################################
|
| 64 |
-
|
| 65 |
-
USER root
|
| 66 |
-
|
| 67 |
-
COPY ./jupyterlab/packages.txt /root/packages.txt
|
| 68 |
-
|
| 69 |
-
# User Debian packages
|
| 70 |
-
## Security warning : Potential user code executed as root (build time)
|
| 71 |
-
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
| 72 |
-
apt-get update && \
|
| 73 |
-
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
|
| 74 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 75 |
-
|
| 76 |
-
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
| 77 |
-
bash /root/on_startup.sh
|
| 78 |
|
|
|
|
| 79 |
RUN mkdir /data && chown user:user /data
|
| 80 |
|
| 81 |
#######################################
|
|
|
|
| 1 |
# Start from the TGI base image
|
| 2 |
FROM ghcr.io/huggingface/text-generation-inference:2.0 as base
|
| 3 |
|
| 4 |
+
# Install git
|
| 5 |
+
RUN apt-get update && apt-get install -y git
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
# Set up the Conda environment
|
| 8 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
|
|
|
| 15 |
|
| 16 |
WORKDIR $HOME/app
|
| 17 |
|
| 18 |
+
# Create a non-root user with UID 1000
|
| 19 |
+
RUN useradd -m -u 1000 -s /bin/bash user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
# Create the /data directory and set its ownership
|
| 22 |
RUN mkdir /data && chown user:user /data
|
| 23 |
|
| 24 |
#######################################
|