FROM python:3.11-slim WORKDIR /app # System dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ gcc g++ libffi-dev \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # spaCy model RUN python -m spacy download en_core_web_sm COPY . . # Hugging Face Spaces expects port 7860 ENV PORT=7860 EXPOSE 7860 # Lazy model loading: models download on first request, # cached to /data/.hf-cache/ persistent volume CMD ["python", "start_hf.py"]