FROM python:3.12-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt ./ RUN pip3 install --no-cache-dir -r requirements.txt COPY src/ ./src/ EXPOSE 8501 ENV STREAMLIT_SERVER_PORT=8501 \ STREAMLIT_SERVER_ADDRESS=0.0.0.0 \ STREAMLIT_SERVER_ENABLE_CORS=false \ STREAMLIT_BROWSER_GATHER_USAGE_STATS=false # Generous start-period: on a free cpu-basic node Streamlit can take ~3 min to # bind 8501 (cold import). Without --start-period the default probe marks the # container UNHEALTHY after ~90 s (3×30 s) BEFORE the app is ready, and HF then # refuses to promote it -> the Space hangs forever at APP_STARTING. 5 min grace # (+ many retries) lets a slow cold start come up before health counts. HEALTHCHECK --start-period=300s --interval=20s --timeout=5s --retries=10 \ CMD curl --fail http://localhost:8501/_stcore/health || exit 1 ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]