| FROM python:3.10-slim | |
| # Set working directory | |
| WORKDIR /code | |
| # Install basic OS tools only (no compiler needed for ctransformers wheels) | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends wget \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy project files | |
| COPY . . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -U pip wheel setuptools \ | |
| && pip install --no-cache-dir -r requirements.txt | |
| # Configure Hugging Face cache to a writable location | |
| ENV HF_HOME=/code/.cache \ | |
| HUGGINGFACE_HUB_CACHE=/code/.cache/huggingface | |
| RUN mkdir -p /code/.cache/huggingface | |
| # Expose FastAPI port | |
| EXPOSE 7860 | |
| # Start the FastAPI app | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |