# Use optimized Python image FROM python:3.9-slim # Set the working directory inside the container WORKDIR /app # Install required system dependencies for OCR & PDFs RUN apt-get update && apt-get install -y \ tesseract-ocr \ poppler-utils \ && rm -rf /var/lib/apt/lists/* # Set environment variables for Hugging Face cache ENV HF_HOME=/tmp/cache RUN mkdir -p /tmp/cache && chmod 777 /tmp/cache # Install Python dependencies COPY requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade pip RUN pip install --no-cache-dir -r requirements.txt # Copy the application code COPY . . # Expose the port for API access EXPOSE 7860 # Use Gunicorn for production CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "app:app"]