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