Spaces:
Sleeping
Sleeping
| # Hugging Face Spaces Docker Runtime | |
| FROM python:3.10-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| tesseract-ocr \ | |
| tesseract-ocr-eng \ | |
| poppler-utils \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev \ | |
| libgomp1 \ | |
| libgl1 \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first for better caching | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| # Upgrade pip first | |
| RUN pip install --no-cache-dir --upgrade pip setuptools wheel | |
| # Install PyTorch CPU version first (before other packages that might depend on it) | |
| RUN pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu \ | |
| torch torchvision | |
| # Install remaining dependencies from requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application files | |
| COPY . . | |
| # Create necessary directories | |
| RUN mkdir -p output pdfs uploads | |
| # Expose Hugging Face Spaces default port | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ | |
| CMD curl -f http://localhost:7860/ || exit 1 | |
| # Run Flask app | |
| CMD ["python", "app.py"] | |