FROM python:3.10-slim WORKDIR /app # Install system dependencies for PDF processing and ML RUN apt-get update && apt-get install -y --no-install-recommends \ tesseract-ocr \ tesseract-ocr-eng \ poppler-utils \ libgomp1 \ git \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python packages COPY backend/requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy application code COPY backend/ . # Set environment variables for HuggingFace and performance ENV TRANSFORMERS_CACHE=/app/.cache/huggingface \ HF_HOME=/app/.cache/huggingface \ PYTHONUNBUFFERED=1 \ TOKENIZERS_PARALLELISM=false # Create cache directory with proper permissions RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]