Spaces:
Sleeping
Sleeping
Ayushnangia
commited on
new Dockerfile with huggingface based new user
Browse files- Dockerfile +20 -13
Dockerfile
CHANGED
@@ -1,9 +1,8 @@
|
|
1 |
-
# Use
|
2 |
FROM python:3.10-slim-buster
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
# Install system dependencies required for Chrome
|
7 |
RUN apt-get update && apt-get install -y \
|
8 |
software-properties-common \
|
9 |
wget \
|
@@ -42,6 +41,7 @@ RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.d
|
|
42 |
&& apt install ./google-chrome-stable_current_amd64.deb -y \
|
43 |
&& rm ./google-chrome-stable_current_amd64.deb
|
44 |
|
|
|
45 |
RUN LATEST=`curl -sSL https://chromedriver.storage.googleapis.com/LATEST_RELEASE` && \
|
46 |
wget -N http://chromedriver.storage.googleapis.com/$LATEST/chromedriver_linux64.zip -P ~/ && \
|
47 |
unzip ~/chromedriver_linux64.zip -d ~/ && \
|
@@ -50,19 +50,26 @@ RUN LATEST=`curl -sSL https://chromedriver.storage.googleapis.com/LATEST_RELEASE
|
|
50 |
chown root:root /usr/local/bin/chromedriver && \
|
51 |
chmod 0755 /usr/local/bin/chromedriver
|
52 |
|
53 |
-
# Set
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
-
# Copy the
|
57 |
-
COPY
|
58 |
|
59 |
-
|
|
|
60 |
|
61 |
-
# Copy the rest of the application
|
62 |
-
COPY . .
|
63 |
-
RUN chmod 777 /code/*
|
64 |
# Expose port 7860 for the Gradio app
|
65 |
EXPOSE 7860
|
66 |
|
67 |
-
# Command to run the application
|
68 |
CMD ["python", "app.py"]
|
|
|
1 |
+
# Use Python 3.10 slim image based on Debian Buster as the base image
|
2 |
FROM python:3.10-slim-buster
|
3 |
|
4 |
+
# Set up system dependencies required for Chrome and general utilities
|
5 |
+
USER root
|
|
|
6 |
RUN apt-get update && apt-get install -y \
|
7 |
software-properties-common \
|
8 |
wget \
|
|
|
41 |
&& apt install ./google-chrome-stable_current_amd64.deb -y \
|
42 |
&& rm ./google-chrome-stable_current_amd64.deb
|
43 |
|
44 |
+
# Download and install Chromedriver
|
45 |
RUN LATEST=`curl -sSL https://chromedriver.storage.googleapis.com/LATEST_RELEASE` && \
|
46 |
wget -N http://chromedriver.storage.googleapis.com/$LATEST/chromedriver_linux64.zip -P ~/ && \
|
47 |
unzip ~/chromedriver_linux64.zip -d ~/ && \
|
|
|
50 |
chown root:root /usr/local/bin/chromedriver && \
|
51 |
chmod 0755 /usr/local/bin/chromedriver
|
52 |
|
53 |
+
# Set up a new user named "user" with user ID 1000 and switch to it
|
54 |
+
RUN useradd -m -u 1000 user
|
55 |
+
USER user
|
56 |
+
|
57 |
+
# Set environment variables
|
58 |
+
ENV HOME=/home/user \
|
59 |
+
PATH=/home/user/.local/bin:$PATH \
|
60 |
+
DISPLAY=:99
|
61 |
+
|
62 |
+
# Set the working directory to the user's home directory/app
|
63 |
+
WORKDIR $HOME/app
|
64 |
|
65 |
+
# Copy the current directory contents into the container at $HOME/app and set the owner to the user
|
66 |
+
COPY --chown=user . $HOME/app
|
67 |
|
68 |
+
# Install Python dependencies with specific versions
|
69 |
+
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt
|
70 |
|
|
|
|
|
|
|
71 |
# Expose port 7860 for the Gradio app
|
72 |
EXPOSE 7860
|
73 |
|
74 |
+
# Command to run the application
|
75 |
CMD ["python", "app.py"]
|