FROM nvidia/cuda:12.1.1-cudnn9-runtime-ubuntu22.04 # Install system deps RUN apt-get update && apt-get install -y \ python3.10 python3-pip git ffmpeg \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY . . RUN pip install --no-cache-dir \ gradio \ insightface==0.7.3 \ onnxruntime-gpu==1.18.0 \ opencv-python-headless \ numpy # Pre-download models RUN python -c " import insightface from insightface.app import FaceAnalysis app = FaceAnalysis(name='buffalo_l', providers=['CUDAExecutionProvider']) app.prepare(ctx_id=0, det_size=(640, 640)) print('Models ready') " CMD ["python", "app.py"]