FROM python:3.11-slim WORKDIR /app # Install system deps RUN apt-get update && apt-get install -y build-essential # Set Hugging Face cache to writable path ENV HF_HOME=/app/.cache # Create the cache directory explicitly RUN mkdir -p /app/.cache # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Pre-download the embedding model RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" # Copy app code COPY . . EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]