FROM python:3.11-slim WORKDIR /app # libpq-dev is required for psycopg2; build-essential for native extensions RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libpq-dev \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Pre-download the sentence-transformers model at build time so cold starts are fast RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" COPY . . # HF Spaces requires port 7860 EXPOSE 7860 CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"]