Platform / Dockerfile
Jacky2305's picture
add g++ for insightface source build; official IPAdapterFaceID impl
4b0a5d8
Raw History Blame Contribute Delete
1.04 kB
FROM python:3.10-slim
WORKDIR /app
# cv2 / insightface 需要的系統庫(slim 鏡像缺這些會 import cv2 炸掉)
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 libglib2.0-0 libgomp1 unzip curl git g++ \
&& rm -rf /var/lib/apt/lists/*
# 構建期下載 insightface antelopev2 人臉模型包(運行期不再聯網,避免 FaceAnalysis assertion)
RUN mkdir -p /app/models && \
curl -sL -o /tmp/antelopev2.zip \
https://github.com/deepinsight/insightface/releases/download/v0.7/antelopev2.zip && \
unzip -q /tmp/antelopev2.zip -d /app/models/ && \
rm /tmp/antelopev2.zip && \
ls /app/models/antelopev2
# CPU 版 torch:用 extra-index-url 同時保留 PyPI,否則依賴包解析會炸
RUN pip install --no-cache-dir torch==2.4.1 --extra-index-url https://download.pytorch.org/whl/cpu
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 7860
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860
CMD ["python", "app.py"]