FROM python:3.11-slim ENV PYTHONUNBUFFERED=1 HF_HOME=/app/.hf_cache WORKDIR /app COPY requirements.txt . # CPU-only torch first (much smaller than the default CUDA build), then the rest RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu \ && pip install --no-cache-dir -r requirements.txt # Bake the query-embedding model into the image so startup needs no download RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('intfloat/multilingual-e5-small')" \ && chmod -R a+rwX /app/.hf_cache COPY . . EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]