Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| # System dependencies for OCR (tesseract + ghostscript) and PDF rendering | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| tesseract-ocr \ | |
| tesseract-ocr-eng \ | |
| ghostscript \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create a non-root user (Hugging Face Spaces requirement) | |
| RUN useradd -m -u 1000 user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR /home/user/app | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Ensure the non-root user owns the app directory | |
| RUN chown -R user:user /home/user/app | |
| USER user | |
| # Hugging Face Spaces expects port 7860 | |
| EXPOSE 7860 | |
| CMD ["python", "app.py", "--host", "0.0.0.0", "--port", "7860"] | |