Update Dockerfile
Browse files- Dockerfile +16 -6
Dockerfile
CHANGED
|
@@ -1,28 +1,38 @@
|
|
|
|
|
| 1 |
FROM python:3.13-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /workspace
|
| 4 |
|
|
|
|
| 5 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 6 |
build-essential curl git && \
|
| 7 |
rm -rf /var/lib/apt/lists/*
|
| 8 |
|
|
|
|
| 9 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 10 |
PYTHONUNBUFFERED=1 \
|
| 11 |
PIP_NO_CACHE_DIR=1 \
|
| 12 |
STREAMLIT_HOME=/tmp \
|
| 13 |
STREAMLIT_TELEMETRY_ENABLED=false
|
| 14 |
|
|
|
|
| 15 |
COPY requirements.txt ./requirements.txt
|
| 16 |
RUN pip install -r requirements.txt
|
| 17 |
|
|
|
|
| 18 |
COPY . .
|
| 19 |
|
| 20 |
-
#
|
| 21 |
ENV PORT=7860
|
| 22 |
-
|
|
|
|
| 23 |
ENV APP_FILE=src/streamlit_app.py
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a small Python base
|
| 2 |
FROM python:3.13-slim
|
| 3 |
|
| 4 |
+
# Workdir inside the container
|
| 5 |
WORKDIR /workspace
|
| 6 |
|
| 7 |
+
# System deps (minimal) and cleanup
|
| 8 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
build-essential curl git && \
|
| 10 |
rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Python/Streamlit env
|
| 13 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 14 |
PYTHONUNBUFFERED=1 \
|
| 15 |
PIP_NO_CACHE_DIR=1 \
|
| 16 |
STREAMLIT_HOME=/tmp \
|
| 17 |
STREAMLIT_TELEMETRY_ENABLED=false
|
| 18 |
|
| 19 |
+
# Install Python deps first for better caching
|
| 20 |
COPY requirements.txt ./requirements.txt
|
| 21 |
RUN pip install -r requirements.txt
|
| 22 |
|
| 23 |
+
# Copy the rest of the repo (including your app code)
|
| 24 |
COPY . .
|
| 25 |
|
| 26 |
+
# Hugging Face Spaces will set $PORT; keep a default for local testing
|
| 27 |
ENV PORT=7860
|
| 28 |
+
|
| 29 |
+
# 👇 Your Streamlit entry file (change if different)
|
| 30 |
ENV APP_FILE=src/streamlit_app.py
|
| 31 |
|
| 32 |
+
# Run Streamlit bound to 0.0.0.0 and $PORT, with proxy-friendly flags
|
| 33 |
+
CMD ["bash","-lc","streamlit run $APP_FILE \
|
| 34 |
+
--server.address 0.0.0.0 \
|
| 35 |
+
--server.port $PORT \
|
| 36 |
+
--server.headless true \
|
| 37 |
+
--server.enableCORS false \
|
| 38 |
+
--server.enableXsrfProtection false"]
|