FROM python:3.9-slim WORKDIR /app # System deps RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg libsm6 libxext6 libxrender-dev libgl1-mesa-glx fontconfig \ && rm -rf /var/lib/apt/lists/* # Cache dirs that must be writable RUN mkdir -p /app/.cache/matplotlib /app/.cache/fontconfig ENV MPLCONFIGDIR=/app/.cache/matplotlib \ FONTCONFIG_PATH=/app/.cache/fontconfig COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy code and Streamlit config COPY src/ ./src/ COPY .streamlit/ ./.streamlit/ # Expose the port the Space will hit EXPOSE 7860 # IMPORTANT: use the port env var Hugging Face injects ENV PORT=7860 ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", \ "--server.headless=true", \ "--server.port=7860", \ "--server.enableXsrfProtection=false", \ "--server.enableCORS=false"]