Spaces:
Sleeping
Sleeping
# -------- base | |
FROM python:3.10-slim | |
ENV PYTHONUNBUFFERED=1 \ | |
PIP_DISABLE_PIP_VERSION_CHECK=1 \ | |
PORT=7860 | |
# -------- system deps (curl for healthcheck) | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
curl \ | |
&& rm -rf /var/lib/apt/lists/* | |
# -------- workdir | |
WORKDIR /app | |
# -------- python deps | |
COPY requirements.txt /app/ | |
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt | |
# -------- app code | |
# (Put ALL your python files in the image) | |
COPY . /app | |
# -------- healthcheck & run | |
# Hugging Face probes container health; probing "/" is the simplest + most robust for Streamlit | |
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=5 \ | |
CMD curl --fail http://127.0.0.1:${PORT}/ || exit 1 | |
# Streamlit must bind to 0.0.0.0 and HF's provided $PORT | |
CMD ["streamlit", "run", "frontend.py", "--server.port=${PORT}", "--server.address=0.0.0.0"] | |