Spaces:
Running
Running
| FROM python:3.12-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE 1 | |
| ENV PYTHONUNBUFFERED 1 | |
| ENV DEBIAN_FRONTEND noninteractive | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| tesseract-ocr \ | |
| tesseract-ocr-mal \ | |
| tesseract-ocr-eng \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| poppler-utils \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory | |
| WORKDIR /app | |
| # Install Python dependencies | |
| # We copy requirements.txt first to leverage Docker cache | |
| COPY requirements.txt . | |
| # Upgrade pip and install requirements | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application | |
| COPY . . | |
| # Expose the API port for Hugging Face Spaces (7860) | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |