FROM python:3.10-slim WORKDIR /app # Install required system packages RUN apt-get update && apt-get install -y \ build-essential \ poppler-utils \ tesseract-ocr \ libgl1 \ && rm -rf /var/lib/apt/lists/* # Create volume-safe directories with proper permissions RUN mkdir -p /app/data /app/cache && chmod -R 777 /app/data /app/cache # Set environment variables for Hugging Face cache ENV TRANSFORMERS_CACHE=/app/cache ENV HF_HOME=/app/cache # Copy all project files COPY . . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt EXPOSE 7860 # Run FastAPI app CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]