FROM python:3.11-slim # Use Python 3.11 - has pre-built wheels for ALL packages, no compilation needed # 3.13 causes pandas/numpy source compilation which fails WORKDIR /app # Install system deps RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* # Copy and install requirements FIRST (Docker layer cache) COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy app files COPY . . # Create non-root user (HuggingFace requirement) RUN useradd -m -u 1000 user USER user EXPOSE 7860 # Run streamlit with file watcher disabled to prevent restart loop ENTRYPOINT ["streamlit", "run", "app.py", \ "--server.port=7860", \ "--server.address=0.0.0.0", \ "--server.headless=true", \ "--server.fileWatcherType=none", \ "--server.runOnSave=false", \ "--browser.gatherUsageStats=false", \ "--server.enableCORS=false", \ "--server.enableXsrfProtection=false"]