FROM python:3.10-slim WORKDIR /app # Install deps first (layer cache) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Pre-download the model during build so cold starts are instant # HF caches it at /root/.cache/huggingface RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-mpnet-base-v2')" # Copy app + artifacts COPY app.py . COPY sdg_data.json . COPY indicator_corpus.pkl . COPY indicator_embeddings.npy . # If you have a fine-tuned model, uncomment this: # COPY finetuned_model/ ./finetuned_model/ # HuggingFace Spaces requires port 7860 EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]