FROM python:3.11-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for caching COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Create data directories RUN mkdir -p data/embeddings data/outputs data/uploads # Expose port 7860 (HuggingFace default) EXPOSE 7860 # Run with gunicorn (1 worker to save memory, 180s timeout for LLM calls) CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "180", "app:app"]