Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +23 -6
Dockerfile
CHANGED
@@ -1,21 +1,38 @@
|
|
1 |
FROM python:3.13.5-slim
|
2 |
|
|
|
3 |
WORKDIR /app
|
4 |
|
5 |
-
|
|
|
6 |
build-essential \
|
|
|
7 |
curl \
|
8 |
git \
|
9 |
&& rm -rf /var/lib/apt/lists/*
|
10 |
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
13 |
|
|
|
|
|
14 |
|
15 |
-
|
|
|
16 |
|
|
|
17 |
EXPOSE 8501
|
18 |
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
|
|
|
|
1 |
FROM python:3.13.5-slim
|
2 |
|
3 |
+
# Set working directory
|
4 |
WORKDIR /app
|
5 |
|
6 |
+
# Install system dependencies (for building Python packages)
|
7 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
8 |
build-essential \
|
9 |
+
python3-dev \
|
10 |
curl \
|
11 |
git \
|
12 |
&& rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
+
# Upgrade pip first
|
15 |
+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
16 |
+
|
17 |
+
# Copy requirements first (for caching)
|
18 |
+
COPY requirements.txt .
|
19 |
|
20 |
+
# Install Python dependencies
|
21 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
22 |
|
23 |
+
# Copy app source code
|
24 |
+
COPY src/ ./src/
|
25 |
|
26 |
+
# Expose Streamlit default port
|
27 |
EXPOSE 8501
|
28 |
|
29 |
+
# Healthcheck (give Streamlit time to boot)
|
30 |
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
31 |
+
CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
32 |
+
|
33 |
+
# Run as non-root user for security (optional but good practice)
|
34 |
+
RUN useradd -m streamlit
|
35 |
+
USER streamlit
|
36 |
|
37 |
+
# Entrypoint to run Streamlit app
|
38 |
+
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|