| FROM python:3.11-slim | |
| # System dependencies: Tesseract OCR + Poppler (PDF rendering) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| tesseract-ocr \ | |
| poppler-utils \ | |
| libgl1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Install Python dependencies first (layer cache) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # HuggingFace Spaces runs on port 7860 | |
| EXPOSE 7860 | |
| # Streamlit config: bind to 0.0.0.0:7860, disable CORS/XSRF for Spaces | |
| ENV STREAMLIT_SERVER_PORT=7860 \ | |
| STREAMLIT_SERVER_ADDRESS=0.0.0.0 \ | |
| STREAMLIT_SERVER_ENABLE_CORS=false \ | |
| STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=false \ | |
| STREAMLIT_BROWSER_GATHER_USAGE_STATS=false | |
| CMD ["streamlit", "run", "app.py"] | |