# Pin Python 3.11 — pydantic 2.4 and transformers 4.33 don't ship wheels for 3.13, # and the HF build image has no Rust toolchain to compile them from source. FROM python:3.11-slim WORKDIR /app # System deps needed by sentence-transformers / chromadb at runtime RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* # Install Python deps first so layer caches well COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # HF Spaces injects PORT=7860 by default; we honor it in app.py. ENV PYTHONUNBUFFERED=1 \ PORT=7860 \ CORS_ALLOWED_ORIGINS="*" EXPOSE 7860 # app.py reads PORT and starts uvicorn on 0.0.0.0 CMD ["python", "app.py"]