| FROM python:3.13.6-slim | |
| # Install system deps | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| poppler-utils \ | |
| tesseract-ocr \ | |
| fonts-dejavu \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create writable dirs | |
| RUN mkdir -p /app/data && chmod -R 777 /app/data | |
| RUN mkdir -p /tmp/matplotlib && chmod -R 777 /tmp/matplotlib | |
| RUN mkdir -p /tmp/fontconfig && chmod -R 777 /tmp/fontconfig | |
| RUN mkdir -p /app/output && chmod -R 777 /app/output # ✅ for your PDFs/plots | |
| # Environment vars for cache dirs | |
| ENV MPLCONFIGDIR=/tmp/matplotlib | |
| ENV XDG_CACHE_HOME=/tmp/fontconfig | |
| # Hugging Face expects port 7860 | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| WORKDIR /app | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| CMD ["python", "app.py"] | |