Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +11 -10
Dockerfile
CHANGED
@@ -4,29 +4,30 @@ FROM python:3.9-slim
|
|
4 |
# Set working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Install system dependencies
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
build-essential \
|
|
|
10 |
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
-
# Copy requirements
|
13 |
COPY requirements.txt .
|
14 |
|
15 |
# Install Python dependencies
|
16 |
RUN pip install --no-cache-dir -r requirements.txt
|
17 |
|
18 |
-
# Copy
|
19 |
-
COPY
|
20 |
|
21 |
-
# Expose the port Streamlit
|
22 |
EXPOSE 8501
|
23 |
|
24 |
-
# Set environment
|
25 |
ENV STREAMLIT_SERVER_PORT=8501
|
26 |
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
|
27 |
|
28 |
-
# Health check
|
29 |
-
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
30 |
|
31 |
-
# Run the application
|
32 |
-
CMD ["streamlit", "run", "app.py"]
|
|
|
4 |
# Set working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Install system dependencies (including curl for the health check)
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
build-essential \
|
10 |
+
curl \
|
11 |
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
+
# Copy requirements to leverage Docker cache
|
14 |
COPY requirements.txt .
|
15 |
|
16 |
# Install Python dependencies
|
17 |
RUN pip install --no-cache-dir -r requirements.txt
|
18 |
|
19 |
+
# Copy all application files (including app.py and the .streamlit folder)
|
20 |
+
COPY . .
|
21 |
|
22 |
+
# Expose the port that Streamlit uses (8501 for Hugging Face Spaces)
|
23 |
EXPOSE 8501
|
24 |
|
25 |
+
# Set environment variables so Streamlit is accessible externally
|
26 |
ENV STREAMLIT_SERVER_PORT=8501
|
27 |
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
|
28 |
|
29 |
+
# Health check to ensure the app is running
|
30 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
31 |
|
32 |
+
# Run the Streamlit application from app.py
|
33 |
+
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|