| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements and install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Set environment variables for better performance | |
| ENV PYTHONUNBUFFERED=1 \ | |
| TRANSFORMERS_CACHE=/app/.cache/huggingface \ | |
| TOKENIZERS_PARALLELISM=true | |
| # Create cache directory for model downloads | |
| RUN mkdir -p /app/.cache/huggingface | |
| # Copy application code | |
| COPY . . | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--reload"] |