# Dockerfile for KUMPAS RAG — Hugging Face Spaces FROM python:3.11-slim # System dependencies for faiss-cpu and sentence-transformers RUN apt-get update && apt-get install -y \ build-essential \ curl \ git \ && rm -rf /var/lib/apt/lists/* # Working directory WORKDIR /app # Copy requirements first (Docker layer caching — faster rebuilds) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY app.py . # Copy your Harry Potter text file COPY harrypotter.txt . # HF Spaces runs on port 7860 EXPOSE 7860 # Predownload the embedding model at build time # (so the first request isn't slow) RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" # Start the server CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]