Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +41 -39
Dockerfile
CHANGED
@@ -1,39 +1,41 @@
|
|
1 |
-
# Use the official Python image from the Docker Hub
|
2 |
-
FROM python:3.10
|
3 |
-
|
4 |
-
# Install system dependencies
|
5 |
-
RUN apt-get update && \
|
6 |
-
apt-get install -y
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
1 |
+
# Use the official Python image from the Docker Hub
|
2 |
+
FROM python:3.10
|
3 |
+
|
4 |
+
# Install system dependencies
|
5 |
+
RUN apt-get update && \
|
6 |
+
apt-get install -y --no-install-recommends \
|
7 |
+
poppler-utils \
|
8 |
+
&& rm -rf /var/lib/apt/lists/* \
|
9 |
+
|| { echo "Package installation failed. Retrying in 3 seconds..."; sleep 3; apt-get update && apt-get install -y poppler-utils; }
|
10 |
+
|
11 |
+
# Set up the working directory
|
12 |
+
WORKDIR /code
|
13 |
+
|
14 |
+
# Copy the current directory contents into the container
|
15 |
+
COPY requirements.txt /code/requirements.txt
|
16 |
+
|
17 |
+
# Install the requirements from the requirements.txt
|
18 |
+
RUN pip install --no-cache-dir -r /code/requirements.txt
|
19 |
+
|
20 |
+
# Create a new user and switch to it
|
21 |
+
RUN useradd -m user
|
22 |
+
USER user
|
23 |
+
|
24 |
+
# Set the environment variables for the user's home and path
|
25 |
+
ENV HOME=/home/user \
|
26 |
+
PATH=$HOME/.local/bin:$PATH
|
27 |
+
|
28 |
+
# Set the working directory to the user's home directory
|
29 |
+
WORKDIR $HOME/app
|
30 |
+
|
31 |
+
# Copy the current directory contents into the container's $HOME/app folder, setting owner to user
|
32 |
+
COPY --chown=user . $HOME/app
|
33 |
+
|
34 |
+
# Copy the .env file into the container
|
35 |
+
COPY --chown=user .env $HOME/app/.env
|
36 |
+
|
37 |
+
# Make port 7860 available to the world outside this container
|
38 |
+
EXPOSE 7860
|
39 |
+
|
40 |
+
# Start the Streamlit app
|
41 |
+
CMD ["streamlit", "run", "app.py"]
|