Spaces:
Building
Building
Update Dockerfile
Browse files- Dockerfile +18 -36
Dockerfile
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
FROM nvidia/cuda:11.3.1-base-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 \
|
@@ -29,37 +29,31 @@ RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
|
29 |
apt-get upgrade -y && \
|
30 |
apt-get install -y --no-install-recommends nvtop
|
31 |
|
32 |
-
|
33 |
RUN install -d -m 0755 /etc/apt/keyrings && \
|
34 |
-
wget -
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
apt-get update && \
|
39 |
apt-get install -y firefox
|
40 |
|
41 |
-
# Install oh-my-zsh & Init
|
42 |
RUN yes | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
43 |
|
44 |
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
45 |
apt-get install -y nodejs && \
|
46 |
npm install -g configurable-http-proxy
|
47 |
|
48 |
-
# Create a working directory
|
49 |
WORKDIR /app
|
50 |
|
51 |
-
# Create a non-root user and switch to it
|
52 |
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
53 |
&& chown -R user:user /app
|
54 |
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
55 |
USER user
|
56 |
|
57 |
-
# All users can use /home/user as their home directory
|
58 |
ENV HOME=/home/user
|
59 |
RUN mkdir $HOME/.cache $HOME/.config \
|
60 |
&& chmod -R 777 $HOME
|
61 |
|
62 |
-
# Set up the Conda environment
|
63 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
64 |
PATH=$HOME/miniconda/bin:$PATH
|
65 |
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
|
@@ -70,45 +64,33 @@ RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39
|
|
70 |
|
71 |
WORKDIR $HOME/app
|
72 |
|
73 |
-
#######################################
|
74 |
-
# Start root user section
|
75 |
-
#######################################
|
76 |
-
|
77 |
USER root
|
78 |
|
79 |
-
# User Debian packages
|
80 |
-
## Security warning : Potential user code executed as root (build time)
|
81 |
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
82 |
apt-get update && \
|
83 |
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
|
84 |
&& rm -rf /var/lib/apt/lists/*
|
85 |
|
86 |
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
87 |
-
|
88 |
-
|
89 |
-
#######################################
|
90 |
-
# End root user section
|
91 |
-
#######################################
|
92 |
|
93 |
USER user
|
94 |
|
95 |
-
# Python packages
|
96 |
RUN --mount=target=requirements.txt,source=requirements.txt \
|
97 |
pip install --no-cache-dir --upgrade -r requirements.txt
|
98 |
|
99 |
-
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
100 |
COPY --chown=user . $HOME/app
|
101 |
|
102 |
RUN chmod +x start_server.sh
|
103 |
|
104 |
-
COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
|
105 |
|
106 |
ENV PYTHONUNBUFFERED=1 \
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
CMD ["./start_server.sh"]
|
|
|
1 |
FROM nvidia/cuda:11.3.1-base-ubuntu20.04
|
2 |
|
3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
4 |
+
TZ=Europe/Paris
|
5 |
|
6 |
+
# Supprimer les sources apt tierces pour éviter les problèmes avec les clés expirées.
|
7 |
+
# Installer quelques utilitaires de base
|
8 |
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
9 |
apt-get update && apt-get install -y --no-install-recommends \
|
10 |
curl \
|
|
|
29 |
apt-get upgrade -y && \
|
30 |
apt-get install -y --no-install-recommends nvtop
|
31 |
|
32 |
+
# Importer la clé GPG pour le dépôt Mozilla Firefox
|
33 |
RUN install -d -m 0755 /etc/apt/keyrings && \
|
34 |
+
wget -qO- https://packages.mozilla.org/keys/mozilla-archive-key-pub.asc | gpg --dearmor | tee /etc/apt/keyrings/mozilla-archive.gpg > /dev/null && \
|
35 |
+
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/mozilla-archive.gpg] http://packages.mozilla.org/pub/mozilla.org/firefox/releases/latest/ubuntu/ focal main" | tee /etc/apt/sources.list.d/mozilla.list
|
36 |
+
|
37 |
+
RUN apt-get update && \
|
|
|
38 |
apt-get install -y firefox
|
39 |
|
|
|
40 |
RUN yes | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
41 |
|
42 |
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
43 |
apt-get install -y nodejs && \
|
44 |
npm install -g configurable-http-proxy
|
45 |
|
|
|
46 |
WORKDIR /app
|
47 |
|
|
|
48 |
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
49 |
&& chown -R user:user /app
|
50 |
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
51 |
USER user
|
52 |
|
|
|
53 |
ENV HOME=/home/user
|
54 |
RUN mkdir $HOME/.cache $HOME/.config \
|
55 |
&& chmod -R 777 $HOME
|
56 |
|
|
|
57 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
58 |
PATH=$HOME/miniconda/bin:$PATH
|
59 |
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
|
|
|
64 |
|
65 |
WORKDIR $HOME/app
|
66 |
|
|
|
|
|
|
|
|
|
67 |
USER root
|
68 |
|
|
|
|
|
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 |
USER user
|
78 |
|
|
|
79 |
RUN --mount=target=requirements.txt,source=requirements.txt \
|
80 |
pip install --no-cache-dir --upgrade -r requirements.txt
|
81 |
|
|
|
82 |
COPY --chown=user . $HOME/app
|
83 |
|
84 |
RUN chmod +x start_server.sh
|
85 |
|
86 |
+
COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
|
87 |
|
88 |
ENV PYTHONUNBUFFERED=1 \
|
89 |
+
GRADIO_ALLOW_FLAGGING=never \
|
90 |
+
GRADIO_NUM_PORTS=1 \
|
91 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
92 |
+
GRADIO_THEME=huggingface \
|
93 |
+
SYSTEM=spaces \
|
94 |
+
SHELL=/bin/bash
|
95 |
+
|
96 |
+
CMD ["./start_server.sh"]
|