Spaces:
Runtime error
Runtime error
node updated to v18LTS, gitignore added, rclone fix
Browse files- .DS_Store +0 -0
- Dockerfile +56 -28
- Dockerfile-original +101 -0
- on_startup.sh +7 -1
- start_server-original.sh +19 -0
.DS_Store
CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
|
|
Dockerfile
CHANGED
@@ -1,14 +1,16 @@
|
|
1 |
# Versi贸n 1.1
|
2 |
# dockerfile-v1.1
|
3 |
# Changelog:
|
4 |
-
# - A帽adido usuario 'user' con permisos de sudo.
|
5 |
# - Ajustados permisos para start_server.sh.
|
6 |
-
# - A帽adido chmod 4755 para sudo.
|
7 |
|
8 |
FROM nvidia/cuda:11.3.1-base-ubuntu20.04
|
9 |
|
10 |
-
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
11 |
|
|
|
|
|
12 |
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
13 |
apt-get update && apt-get install -y --no-install-recommends \
|
14 |
curl \
|
@@ -24,47 +26,75 @@ RUN rm -f /etc/apt/sources.list.d/*.list && \
|
|
24 |
build-essential \
|
25 |
libsndfile-dev \
|
26 |
software-properties-common \
|
27 |
-
openssh-server \
|
28 |
-
fuse \
|
29 |
&& rm -rf /var/lib/apt/lists/*
|
30 |
|
31 |
-
RUN curl https://rclone.org/install.sh | bash
|
32 |
-
|
33 |
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
34 |
apt-get upgrade -y && \
|
35 |
apt-get install -y --no-install-recommends nvtop
|
36 |
|
37 |
-
RUN curl -sL https://deb.nodesource.com/
|
38 |
apt-get install -y nodejs && \
|
39 |
npm install -g configurable-http-proxy
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
42 |
-
PATH
|
43 |
-
RUN curl -sLo
|
44 |
-
&& chmod +x
|
45 |
-
&&
|
46 |
-
&& rm
|
47 |
&& conda clean -ya
|
48 |
|
49 |
-
WORKDIR /
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
|
52 |
-
RUN /root/miniconda/bin/pip install --no-cache-dir --upgrade -r requirements.txt
|
53 |
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
56 |
|
57 |
-
|
|
|
58 |
|
59 |
-
|
60 |
-
RUN chown -R user:user /home/user/.config
|
61 |
-
RUN chmod +x /root/app/start_server.sh
|
62 |
|
63 |
-
|
|
|
|
|
64 |
|
65 |
USER user
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
ENV PYTHONUNBUFFERED=1 \
|
70 |
GRADIO_ALLOW_FLAGGING=never \
|
@@ -74,6 +104,4 @@ ENV PYTHONUNBUFFERED=1 \
|
|
74 |
SYSTEM=spaces \
|
75 |
SHELL=/bin/bash
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
CMD ["/root/app/start_server.sh"]
|
|
|
1 |
# Versi贸n 1.1
|
2 |
# dockerfile-v1.1
|
3 |
# Changelog:
|
4 |
+
# - A帽adido usuario 'user' con permisos de sudo sin contrase帽a.
|
5 |
# - Ajustados permisos para start_server.sh.
|
|
|
6 |
|
7 |
FROM nvidia/cuda:11.3.1-base-ubuntu20.04
|
8 |
|
9 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
10 |
+
TZ=Europe/Paris
|
11 |
|
12 |
+
# Remove any third-party apt sources to avoid issues with expiring keys.
|
13 |
+
# Install some basic utilities
|
14 |
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
15 |
apt-get update && apt-get install -y --no-install-recommends \
|
16 |
curl \
|
|
|
26 |
build-essential \
|
27 |
libsndfile-dev \
|
28 |
software-properties-common \
|
|
|
|
|
29 |
&& rm -rf /var/lib/apt/lists/*
|
30 |
|
|
|
|
|
31 |
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
32 |
apt-get upgrade -y && \
|
33 |
apt-get install -y --no-install-recommends nvtop
|
34 |
|
35 |
+
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
36 |
apt-get install -y nodejs && \
|
37 |
npm install -g configurable-http-proxy
|
38 |
|
39 |
+
# Create a working directory
|
40 |
+
WORKDIR /app
|
41 |
+
|
42 |
+
# Create a non-root user and switch to it
|
43 |
+
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
44 |
+
&& chown -R user:user /app
|
45 |
+
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
46 |
+
USER user
|
47 |
+
|
48 |
+
# All users can use /home/user as their home directory
|
49 |
+
ENV HOME=/home/user
|
50 |
+
RUN mkdir $HOME/.cache $HOME/.config \
|
51 |
+
&& chmod -R 777 $HOME
|
52 |
+
|
53 |
+
# Set up the Conda environment
|
54 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
55 |
+
PATH=$HOME/miniconda/bin:$PATH
|
56 |
+
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
|
57 |
+
&& chmod +x ~/miniconda.sh \
|
58 |
+
&& ~/miniconda.sh -b -p ~/miniconda \
|
59 |
+
&& rm ~/miniconda.sh \
|
60 |
&& conda clean -ya
|
61 |
|
62 |
+
WORKDIR $HOME/app
|
63 |
+
|
64 |
+
#######################################
|
65 |
+
# Start root user section
|
66 |
+
#######################################
|
67 |
|
68 |
+
USER root
|
|
|
69 |
|
70 |
+
# User Debian packages
|
71 |
+
## Security warning : Potential user code executed as root (build time)
|
72 |
+
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
73 |
+
apt-get update && \
|
74 |
+
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
|
75 |
+
&& rm -rf /var/lib/apt/lists/*
|
76 |
|
77 |
+
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
78 |
+
bash /root/on_startup.sh
|
79 |
|
80 |
+
RUN mkdir /data && chown user:user /data
|
|
|
|
|
81 |
|
82 |
+
#######################################
|
83 |
+
# End root user section
|
84 |
+
#######################################
|
85 |
|
86 |
USER user
|
87 |
+
|
88 |
+
# Python packages
|
89 |
+
RUN --mount=target=requirements.txt,source=requirements.txt \
|
90 |
+
pip install --no-cache-dir --upgrade -r requirements.txt
|
91 |
+
|
92 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
93 |
+
COPY --chown=user . $HOME/app
|
94 |
+
|
95 |
+
RUN chmod +x /home/user/app/start_server.sh
|
96 |
+
|
97 |
+
COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
|
98 |
|
99 |
ENV PYTHONUNBUFFERED=1 \
|
100 |
GRADIO_ALLOW_FLAGGING=never \
|
|
|
104 |
SYSTEM=spaces \
|
105 |
SHELL=/bin/bash
|
106 |
|
107 |
+
CMD ["./start_server.sh"]
|
|
|
|
Dockerfile-original
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM nvidia/cuda:11.3.1-base-ubuntu20.04
|
2 |
+
|
3 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
4 |
+
TZ=Europe/Paris
|
5 |
+
|
6 |
+
# Remove any third-party apt sources to avoid issues with expiring keys.
|
7 |
+
# Install some basic utilities
|
8 |
+
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
9 |
+
apt-get update && apt-get install -y --no-install-recommends \
|
10 |
+
curl \
|
11 |
+
ca-certificates \
|
12 |
+
sudo \
|
13 |
+
git \
|
14 |
+
git-lfs \
|
15 |
+
zip \
|
16 |
+
unzip \
|
17 |
+
htop \
|
18 |
+
bzip2 \
|
19 |
+
libx11-6 \
|
20 |
+
build-essential \
|
21 |
+
libsndfile-dev \
|
22 |
+
software-properties-common \
|
23 |
+
&& rm -rf /var/lib/apt/lists/*
|
24 |
+
|
25 |
+
RUN add-apt-repository ppa:flexiondotorg/nvtop && \
|
26 |
+
apt-get upgrade -y && \
|
27 |
+
apt-get install -y --no-install-recommends nvtop
|
28 |
+
|
29 |
+
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
30 |
+
apt-get install -y nodejs && \
|
31 |
+
npm install -g configurable-http-proxy
|
32 |
+
|
33 |
+
# Create a working directory
|
34 |
+
WORKDIR /app
|
35 |
+
|
36 |
+
# Create a non-root user and switch to it
|
37 |
+
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
38 |
+
&& chown -R user:user /app
|
39 |
+
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
40 |
+
USER user
|
41 |
+
|
42 |
+
# All users can use /home/user as their home directory
|
43 |
+
ENV HOME=/home/user
|
44 |
+
RUN mkdir $HOME/.cache $HOME/.config \
|
45 |
+
&& chmod -R 777 $HOME
|
46 |
+
|
47 |
+
# Set up the Conda environment
|
48 |
+
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
49 |
+
PATH=$HOME/miniconda/bin:$PATH
|
50 |
+
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
|
51 |
+
&& chmod +x ~/miniconda.sh \
|
52 |
+
&& ~/miniconda.sh -b -p ~/miniconda \
|
53 |
+
&& rm ~/miniconda.sh \
|
54 |
+
&& conda clean -ya
|
55 |
+
|
56 |
+
WORKDIR $HOME/app
|
57 |
+
|
58 |
+
#######################################
|
59 |
+
# Start root user section
|
60 |
+
#######################################
|
61 |
+
|
62 |
+
USER root
|
63 |
+
|
64 |
+
# User Debian packages
|
65 |
+
## Security warning : Potential user code executed as root (build time)
|
66 |
+
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
67 |
+
apt-get update && \
|
68 |
+
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
|
69 |
+
&& rm -rf /var/lib/apt/lists/*
|
70 |
+
|
71 |
+
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
72 |
+
bash /root/on_startup.sh
|
73 |
+
|
74 |
+
RUN mkdir /data && chown user:user /data
|
75 |
+
|
76 |
+
#######################################
|
77 |
+
# End root user section
|
78 |
+
#######################################
|
79 |
+
|
80 |
+
USER user
|
81 |
+
|
82 |
+
# Python packages
|
83 |
+
RUN --mount=target=requirements.txt,source=requirements.txt \
|
84 |
+
pip install --no-cache-dir --upgrade -r requirements.txt
|
85 |
+
|
86 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
87 |
+
COPY --chown=user . $HOME/app
|
88 |
+
|
89 |
+
RUN chmod +x start_server.sh
|
90 |
+
|
91 |
+
COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
|
92 |
+
|
93 |
+
ENV PYTHONUNBUFFERED=1 \
|
94 |
+
GRADIO_ALLOW_FLAGGING=never \
|
95 |
+
GRADIO_NUM_PORTS=1 \
|
96 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
97 |
+
GRADIO_THEME=huggingface \
|
98 |
+
SYSTEM=spaces \
|
99 |
+
SHELL=/bin/bash
|
100 |
+
|
101 |
+
CMD ["./start_server.sh"]
|
on_startup.sh
CHANGED
@@ -1,5 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
#!/bin/bash
|
2 |
# Write some commands here that will run on root user before startup.
|
3 |
# For example, to clone transformers and install it in dev mode:
|
4 |
# git clone https://github.com/huggingface/transformers.git
|
5 |
-
# cd transformers && pip install -e ".[dev]"
|
|
|
1 |
+
# Versi贸n 1.1
|
2 |
+
# on_startup.sh-v1.1
|
3 |
+
# Changelog:
|
4 |
+
# - Asegurado que el script tenga permisos ejecutables.
|
5 |
+
# - Verificado que el script tiene el formato correcto y el shebang.
|
6 |
+
|
7 |
#!/bin/bash
|
8 |
# Write some commands here that will run on root user before startup.
|
9 |
# For example, to clone transformers and install it in dev mode:
|
10 |
# git clone https://github.com/huggingface/transformers.git
|
11 |
+
# cd transformers && pip install -e ".[dev]"
|
start_server-original.sh
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
JUPYTER_TOKEN="${JUPYTER_TOKEN:=huggingface}"
|
3 |
+
|
4 |
+
echo "Starting Jupyter Lab with token $JUPYTER_TOKEN"
|
5 |
+
|
6 |
+
NOTEBOOK_DIR="/data"
|
7 |
+
|
8 |
+
jupyter-lab \
|
9 |
+
--ip 0.0.0.0 \
|
10 |
+
--port 7860 \
|
11 |
+
--no-browser \
|
12 |
+
--allow-root \
|
13 |
+
--ServerApp.token="$JUPYTER_TOKEN" \
|
14 |
+
--ServerApp.tornado_settings="{'headers': {'Content-Security-Policy': 'frame-ancestors *'}}" \
|
15 |
+
--ServerApp.cookie_options="{'SameSite': 'None', 'Secure': True}" \
|
16 |
+
--ServerApp.disable_check_xsrf=True \
|
17 |
+
--LabApp.news_url=None \
|
18 |
+
--LabApp.check_for_updates_class="jupyterlab.NeverCheckForUpdate" \
|
19 |
+
--notebook-dir=$NOTEBOOK_DIR
|