FROM python:3.11 # System deps for opencv RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 && rm -rf /var/lib/apt/lists/* # Python deps - use pip cache for faster rebuilds RUN pip install --no-cache-dir \ fastapi==0.111.0 \ uvicorn[standard]==0.29.0 \ python-multipart==0.0.9 \ numpy==1.26.4 \ opencv-python-headless==4.9.0.80 \ Pillow==10.3.0 \ huggingface_hub # These are large - install separately for better error visibility RUN pip install --no-cache-dir onnxruntime==1.17.3 RUN pip install --no-cache-dir insightface==0.7.3 # Setup user RUN useradd -m -u 1000 user WORKDIR /home/user/app COPY main.py startup.py ./ RUN chown -R user:user /home/user/app USER user EXPOSE 7860 CMD ["python", "startup.py"]