FROM python:3.12-slim WORKDIR /app # System deps RUN apt-get update -qq && apt-get install -y -qq --no-install-recommends \ build-essential && \ rm -rf /var/lib/apt/lists/* # Python deps (no torch — fastembed uses ONNX) COPY requirements-hf.txt . RUN pip install --no-cache-dir -r requirements-hf.txt # The search model (~240 MB) into the image, so a start never downloads it. # Before the app's other files: this layer only rebuilds when embedder.py does. COPY embedder.py . RUN python embedder.py # Copy app. deploy-hf-3.sh stages only the modules reachable from the entry # points, so the build context is already the exact set we want — listing files # here as well just means a new module gets missed twice. COPY *.py ./ COPY static/ static/ COPY db/ db/ COPY data/ data/ # Create logs dir RUN mkdir -p logs # IP location files for /stats (DB-IP Lite, monthly); every build fetches current ones RUN python geo.py # HF Spaces expects port 7860 ENV PORT=7860 EXPOSE 7860 # Run with startup.py (loading screen + benchmark) CMD ["python", "startup.py"]