Update Dockerfile
Browse files- Dockerfile +28 -8
Dockerfile
CHANGED
|
@@ -1,20 +1,40 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
|
|
|
|
| 6 |
build-essential \
|
| 7 |
curl \
|
| 8 |
git \
|
| 9 |
-
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
|
|
|
| 16 |
EXPOSE 8501
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
| 1 |
+
# Base image
|
| 2 |
+
FROM python:3.13-slim
|
| 3 |
|
| 4 |
+
# Set workdir early
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# System deps (curl for healthcheck, build tools if wheels need compiling)
|
| 8 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
build-essential \
|
| 10 |
curl \
|
| 11 |
git \
|
| 12 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Python/runtime env
|
| 15 |
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 16 |
+
PYTHONUNBUFFERED=1 \
|
| 17 |
+
PIP_NO_CACHE_DIR=1
|
| 18 |
+
|
| 19 |
+
# --- Fix Streamlit permission error & disable telemetry ---
|
| 20 |
+
# (add before EXPOSE/CMD as per guidance)
|
| 21 |
+
ENV STREAMLIT_HOME=/tmp
|
| 22 |
+
ENV STREAMLIT_TELEMETRY_ENABLED=false
|
| 23 |
+
# --------------------------------------------------------
|
| 24 |
|
| 25 |
+
# Install Python deps (layer-cached)
|
| 26 |
+
COPY requirements.txt .
|
| 27 |
+
RUN pip install -r requirements.txt
|
| 28 |
+
|
| 29 |
+
# Copy app source
|
| 30 |
+
COPY src/ ./src/
|
| 31 |
|
| 32 |
+
# Streamlit port
|
| 33 |
EXPOSE 8501
|
| 34 |
|
| 35 |
+
# Simple healthcheck
|
| 36 |
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=20s --retries=3 \
|
| 37 |
+
CMD curl -fsS http://localhost:8501/_stcore/health || exit 1
|
| 38 |
|
| 39 |
+
# Run the app
|
| 40 |
+
CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|