FROM python:3.10-slim # Install g++ for InsightFace's small Cython extension RUN apt-get update && apt-get install -y \ build-essential \ && rm -rf /var/lib/apt/lists/* # Install all packages — onnxruntime 1.18.1 supports NumPy 2.x RUN pip install --no-cache-dir \ insightface==0.7.3 \ onnxruntime==1.18.1 \ fastapi==0.111.0 \ "uvicorn[standard]==0.29.0" \ Pillow \ python-multipart==0.0.9 \ supabase==2.4.6 \ python-dotenv==1.0.1 # Pre-download face recognition model during build RUN python -c "\ from insightface.app import FaceAnalysis; \ app = FaceAnalysis(name='buffalo_sc', providers=['CPUExecutionProvider']); \ app.prepare(ctx_id=-1, det_size=(320, 320))" WORKDIR /app COPY main.py . EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]