Update Dockerfile
Browse files- Dockerfile +55 -63
Dockerfile
CHANGED
@@ -1,99 +1,91 @@
|
|
1 |
-
FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
|
2 |
-
|
3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
4 |
-
|
5 |
-
HOME=/root
|
6 |
|
7 |
-
# Remove any third-party apt sources
|
|
|
8 |
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
9 |
apt-get update && apt-get install -y --no-install-recommends \
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
&& rm -rf /var/lib/apt/lists/*
|
30 |
|
31 |
-
# Install nvtop
|
32 |
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
33 |
apt-get upgrade -y && \
|
34 |
apt-get install -y --no-install-recommends nvtop
|
35 |
|
36 |
-
|
37 |
-
RUN curl -sL https://deb.nodesource.com/setup_21.x | bash - && \
|
38 |
apt-get install -y nodejs && \
|
39 |
npm install -g configurable-http-proxy
|
40 |
|
41 |
-
#
|
42 |
WORKDIR /app
|
43 |
|
44 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
46 |
-
PATH=/
|
47 |
-
RUN curl -sLo /tmp/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
|
53 |
WORKDIR /app
|
54 |
|
55 |
-
|
56 |
-
# Additional root-level operations
|
57 |
-
#######################################
|
58 |
-
|
59 |
-
# Install extra Debian packages (packages.txt must be provided)
|
60 |
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
61 |
apt-get update && \
|
62 |
-
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends
|
63 |
-
rm -rf /var/lib/apt/lists/*
|
64 |
|
65 |
-
# Run startup script (if provided)
|
66 |
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
67 |
-
|
68 |
-
|
69 |
-
# Create data directory
|
70 |
-
RUN mkdir /data
|
71 |
|
72 |
-
|
73 |
-
# Python packages and application files
|
74 |
-
#######################################
|
75 |
|
76 |
-
#
|
77 |
RUN --mount=target=requirements.txt,source=requirements.txt \
|
78 |
pip install --no-cache-dir --upgrade -r requirements.txt
|
79 |
|
80 |
-
#
|
81 |
-
RUN pip install --no-cache-dir jupyterlab
|
82 |
-
|
83 |
-
# Copy the current directory contents into /app
|
84 |
COPY . /app
|
85 |
|
86 |
RUN chmod +x start_server.sh
|
87 |
|
88 |
-
|
89 |
-
COPY login.html /root/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
|
90 |
|
91 |
ENV PYTHONUNBUFFERED=1 \
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
|
99 |
CMD ["./start_server.sh"]
|
|
|
|
|
|
|
1 |
ENV DEBIAN_FRONTEND=noninteractive \
|
2 |
+
TZ=Europe/Paris
|
|
|
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 |
+
wget \
|
13 |
+
procps \
|
14 |
+
git-lfs \
|
15 |
+
zip \
|
16 |
+
aria2 \
|
17 |
+
unzip \
|
18 |
+
ffmpeg \
|
19 |
+
htop \
|
20 |
+
vim \
|
21 |
+
nano \
|
22 |
+
bzip2 \
|
23 |
+
libx11-6 \
|
24 |
+
build-essential \
|
25 |
+
libsndfile-dev \
|
26 |
+
software-properties-common \
|
27 |
&& rm -rf /var/lib/apt/lists/*
|
28 |
|
|
|
29 |
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
30 |
apt-get upgrade -y && \
|
31 |
apt-get install -y --no-install-recommends nvtop
|
32 |
|
33 |
+
RUN curl -sL https://deb.nodesource.com/setup_21.x | bash - && \
|
|
|
34 |
apt-get install -y nodejs && \
|
35 |
npm install -g configurable-http-proxy
|
36 |
|
37 |
+
# Create a working directory
|
38 |
WORKDIR /app
|
39 |
|
40 |
+
# Create a user account but continue using root
|
41 |
+
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
42 |
+
&& chown -R user:user /app
|
43 |
+
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
44 |
+
|
45 |
+
# Create home directories that will be accessible
|
46 |
+
ENV HOME=/home/user
|
47 |
+
RUN mkdir -p $HOME/.cache $HOME/.config \
|
48 |
+
&& chmod -R 777 $HOME
|
49 |
+
|
50 |
+
# Set up the Conda environment (as root)
|
51 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
52 |
+
PATH=/opt/conda/bin:$PATH
|
53 |
+
RUN curl -sLo /tmp/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
|
54 |
+
&& chmod +x /tmp/miniconda.sh \
|
55 |
+
&& /tmp/miniconda.sh -b -p /opt/conda \
|
56 |
+
&& rm /tmp/miniconda.sh \
|
57 |
+
&& conda clean -ya
|
58 |
|
59 |
WORKDIR /app
|
60 |
|
61 |
+
# User Debian packages
|
|
|
|
|
|
|
|
|
62 |
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
63 |
apt-get update && \
|
64 |
+
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
|
65 |
+
&& rm -rf /var/lib/apt/lists/*
|
66 |
|
|
|
67 |
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
68 |
+
bash /root/on_startup.sh
|
|
|
|
|
|
|
69 |
|
70 |
+
RUN mkdir -p /data && chown user:user /data
|
|
|
|
|
71 |
|
72 |
+
# Python packages
|
73 |
RUN --mount=target=requirements.txt,source=requirements.txt \
|
74 |
pip install --no-cache-dir --upgrade -r requirements.txt
|
75 |
|
76 |
+
# Copy the current directory contents into the container
|
|
|
|
|
|
|
77 |
COPY . /app
|
78 |
|
79 |
RUN chmod +x start_server.sh
|
80 |
|
81 |
+
COPY login.html /opt/conda/lib/python3.9/site-packages/jupyter_server/templates/login.html
|
|
|
82 |
|
83 |
ENV PYTHONUNBUFFERED=1 \
|
84 |
+
GRADIO_ALLOW_FLAGGING=never \
|
85 |
+
GRADIO_NUM_PORTS=1 \
|
86 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
87 |
+
GRADIO_THEME=huggingface \
|
88 |
+
SYSTEM=spaces \
|
89 |
+
SHELL=/bin/bash
|
90 |
|
91 |
CMD ["./start_server.sh"]
|