| # Use the official Python image | |
| FROM python:3.9 | |
| # Set the working directory inside the container | |
| WORKDIR / | |
| # Set environment variable for writable Hugging Face cache | |
| ENV TRANSFORMERS_CACHE=/tmp/huggingface | |
| # Copy and install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the app code | |
| COPY . . | |
| # Expose the API on port 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |