Commit
•
9999e5f
1
Parent(s):
6d3aa6a
Adding jupyterlab
Browse files- Dockerfile +88 -28
- requirements.txt +0 -1
Dockerfile
CHANGED
@@ -1,44 +1,104 @@
|
|
1 |
# Start from the TGI base image
|
2 |
FROM ghcr.io/huggingface/text-generation-inference:2.0 as base
|
3 |
|
4 |
-
#
|
5 |
-
|
|
|
|
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
RUN
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
|
|
|
13 |
|
14 |
-
# Create
|
15 |
-
|
16 |
|
17 |
-
#
|
|
|
|
|
|
|
18 |
USER user
|
19 |
|
20 |
-
#
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
ENV PATH="/home/user/.local/bin:${PATH}"
|
25 |
|
26 |
-
#
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
SYSTEM=spaces
|
39 |
|
40 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
41 |
-
COPY --chown=user
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
|
44 |
-
CMD python /home/user/app.py
|
|
|
1 |
# Start from the TGI base image
|
2 |
FROM ghcr.io/huggingface/text-generation-inference:2.0 as base
|
3 |
|
4 |
+
#COPY ./requirements.txt /code/requirements.txt
|
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 \
|
52 |
+
PATH=$HOME/miniconda/bin:$PATH
|
53 |
+
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
|
54 |
+
&& chmod +x ~/miniconda.sh \
|
55 |
+
&& ~/miniconda.sh -b -p ~/miniconda \
|
56 |
+
&& rm ~/miniconda.sh \
|
57 |
+
&& conda clean -ya
|
58 |
+
|
59 |
+
WORKDIR $HOME/app
|
60 |
+
|
61 |
+
#######################################
|
62 |
+
# Start root user section
|
63 |
+
#######################################
|
64 |
|
65 |
+
USER root
|
|
|
66 |
|
67 |
+
# User Debian packages
|
68 |
+
## Security warning : Potential user code executed as root (build time)
|
69 |
+
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
70 |
+
apt-get update && \
|
71 |
+
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
|
72 |
+
&& rm -rf /var/lib/apt/lists/*
|
73 |
+
|
74 |
+
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
75 |
+
bash /root/on_startup.sh
|
76 |
+
|
77 |
+
RUN mkdir /data && chown user:user /data
|
78 |
|
79 |
+
#######################################
|
80 |
+
# End root user section
|
81 |
+
#######################################
|
82 |
+
|
83 |
+
USER user
|
84 |
+
|
85 |
+
# Python packages
|
86 |
+
RUN --mount=target=requirements.txt,source=requirements.txt \
|
87 |
+
pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
88 |
|
89 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
90 |
+
COPY --chown=user ./jupyterlab $HOME/app
|
91 |
+
|
92 |
+
RUN chmod +x start_server.sh
|
93 |
+
|
94 |
+
COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
|
95 |
+
|
96 |
+
ENV PYTHONUNBUFFERED=1 \
|
97 |
+
GRADIO_ALLOW_FLAGGING=never \
|
98 |
+
GRADIO_NUM_PORTS=1 \
|
99 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
100 |
+
GRADIO_THEME=huggingface \
|
101 |
+
SYSTEM=spaces \
|
102 |
+
SHELL=/bin/bash
|
103 |
|
104 |
+
CMD ["./start_server.sh"]
|
|
requirements.txt
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
gradio==4.26.0
|
|
|
|