Spaces:
Sleeping
Sleeping
Commit ·
863c152
1
Parent(s): 29af6e6
Update Dockerfile
Browse files- Dockerfile +15 -3
Dockerfile
CHANGED
|
@@ -33,8 +33,16 @@ RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
|
|
| 33 |
# Create a working directory
|
| 34 |
WORKDIR /app
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
# All users can use /home/user as their home directory
|
| 37 |
-
ENV HOME=/
|
|
|
|
|
|
|
| 38 |
|
| 39 |
# Set up the Conda environment
|
| 40 |
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
|
@@ -67,15 +75,19 @@ RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
|
| 67 |
# End root user section
|
| 68 |
#######################################
|
| 69 |
|
|
|
|
|
|
|
| 70 |
# Python packages
|
| 71 |
RUN --mount=target=requirements.txt,source=requirements.txt \
|
| 72 |
pip install --no-cache-dir --upgrade -r requirements.txt
|
| 73 |
|
| 74 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 75 |
-
COPY --chown=
|
| 76 |
|
| 77 |
RUN chmod +x start_server.sh
|
| 78 |
|
|
|
|
|
|
|
| 79 |
ENV PYTHONUNBUFFERED=1 \
|
| 80 |
GRADIO_ALLOW_FLAGGING=never \
|
| 81 |
GRADIO_NUM_PORTS=1 \
|
|
@@ -84,4 +96,4 @@ ENV PYTHONUNBUFFERED=1 \
|
|
| 84 |
SYSTEM=spaces \
|
| 85 |
SHELL=/bin/bash
|
| 86 |
|
| 87 |
-
CMD ["./start_server.sh"]
|
|
|
|
| 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 \
|
|
|
|
| 75 |
# End root user section
|
| 76 |
#######################################
|
| 77 |
|
| 78 |
+
USER user
|
| 79 |
+
|
| 80 |
# Python packages
|
| 81 |
RUN --mount=target=requirements.txt,source=requirements.txt \
|
| 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 . $HOME/app
|
| 86 |
|
| 87 |
RUN chmod +x start_server.sh
|
| 88 |
|
| 89 |
+
COPY --chown=user login.html /home/user/miniconda/lib/python3.9/site-packages/jupyter_server/templates/login.html
|
| 90 |
+
|
| 91 |
ENV PYTHONUNBUFFERED=1 \
|
| 92 |
GRADIO_ALLOW_FLAGGING=never \
|
| 93 |
GRADIO_NUM_PORTS=1 \
|
|
|
|
| 96 |
SYSTEM=spaces \
|
| 97 |
SHELL=/bin/bash
|
| 98 |
|
| 99 |
+
CMD ["./start_server.sh"]
|