cfcpu / Dockerfile
rootuc
update
a302e6e
Raw History Blame Contribute Delete
1.33 kB
# 使用支持 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"]