Spaces:
Sleeping
Sleeping
| FROM python:3.9-slim | |
| ENV HF_HOME=/tmp/huggingface | |
| # Install system dependencies | |
| # HF spaces runs on Debian-based images | |
| RUN apt-get update && apt-get install -y \ | |
| poppler-utils \ | |
| tesseract-ocr \ | |
| tesseract-ocr-eng \ | |
| tesseract-ocr-ara \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set up a new user named "user" with user ID 1000 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements and install | |
| COPY --chown=user requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy project files | |
| COPY --chown=user . . | |
| # Expose port 7860 for Hugging Face Spaces | |
| EXPOSE 7860 | |
| ENV PYTHONUNBUFFERED=1 | |
| # Run uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |