Spaces:
Running
Running
Download Dockerfile from jacky3102/Platform: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/spaces/jacky3102/Platform/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/jacky3102/Platform/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/jacky3102/Platform/resolve/main/Dockerfile
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"] | |