FROM python:3.10-slim WORKDIR /app # 安装系统依赖 RUN apt-get update && apt-get install -y \ git \ wget \ curl \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # 克隆 ComfyUI RUN git clone https://github.com/comfyanonymous/ComfyUI.git . # 安装 Python 依赖(CPU 版本) 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 # 创建必要的目录结构 RUN mkdir -p \ models/checkpoints \ models/vae \ models/loras \ models/controlnet \ models/upscale_models \ models/clip_vision \ models/embeddings \ input \ output # 设置环境变量强制使用 CPU ENV CUDA_VISIBLE_DEVICES="" ENV PYTHONUNBUFFERED=1 # 暴露端口 EXPOSE 7860 # 启动 ComfyUI(强制 CPU 模式) CMD ["python", "main.py", "--listen", "0.0.0.0", "--port", "7860", "--cpu"]