File size: 1,328 Bytes
6bf55b4 43203db 6bf55b4 43203db 6bf55b4 a302e6e 6bf55b4 a302e6e 6bf55b4 9da3834 6bf55b4 a302e6e 6bf55b4 a302e6e 2d1712e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # 使用支持 CUDA 的基础镜像(如果要在 CPU 运行,基础镜像也通用)
FROM python:3.10-slim
# 设置工作目录
WORKDIR /app
# 安装系统依赖
RUN apt-get update && apt-get install -y \
git \
libgl1-mesa-dri \
libglib2.0-0 \
wget \
&& rm -rf /var/lib/apt/lists/*
#libgl1-mesa-glx \
# 克隆 ComfyUI 源码
RUN git clone https://github.com/comfyanonymous/ComfyUI.git .
# 安装依赖 (优先安装 Torch,确保版本匹配)
RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir -r requirements.txt
# 创建模型目录(可选:在此处预下载一个小模型,如 SD1.5 Pruned)
#RUN wget -O models/checkpoints/v1-5-pruned-emaonly.safetensors \
# https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors
#RUN git clone https://github.com/ltdrdata/ComfyUI-Manager custom_nodes/comfyui-manager
# 暴露 Hugging Face 指定端口
EXPOSE 7860
ADD entrypoint.sh /app/entrypoint.sh
# 启动命令:使用 --listen 监听所有接口,--port 7860 适配 HF
# 如果是纯 CPU 环境,建议加上 --cpu 参数
#CMD ["python3", "main.py", "--listen", "0.0.0.0", "--port", "7860", "--cpu"]
ENTRYPOINT ["sh", "/app/entrypoint.sh"]
|