logo
1
0
Login
"优化README文档结构,统一镜像命名规范并更新详细说明"

Docker镜像构建说明

项目概述

本项目包含三个层次的Docker镜像,用于构建ComfyUI运行环境:

  1. 基础镜像 - 提供操作系统基础工具和运行环境
  2. ComfyUI基础镜像 - 继承基础镜像,安装Node.js和ComfyUI核心
  3. ComfyUI插件镜像 - 继承ComfyUI基础镜像,安装额外依赖和自定义节点

镜像层次结构

镜像详细说明

1. 构建基础环境镜像(base) (1_base/Dockerfile)

FROM pytorch/pytorch:2.7.0-cuda12.8-cudnn9-devel # 安装基础工具 RUN apt-get update && apt-get install -y \ git git-lfs wget unzip openssh-server curl htop nload zsh \ iproute2 iputils-ping net-tools vim ca-certificates \ && apt-get clean && rm -rf /var/lib/apt/lists/* # 配置中文环境 ENV LANG=C.UTF-8 ENV LANGUAGE=C.UTF-8

功能:

  • 基于PyTorch官方CUDA镜像
  • 安装开发调试工具集
  • 配置中文环境支持

2. 构建ComfyUI主程序镜像(main) (2_comfyui/Dockerfile)

FROM ccr.ccs.tencentyun.com/b-b-x.cnb/comfyui:base # 安装Node.js RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \ && apt-get install -y nodejs \ && apt-get clean && rm -rf /var/lib/apt/lists/* # 安装ComfyUI WORKDIR /opt RUN git clone https://github.com/comfyanonymous/ComfyUI.git \ && cd ComfyUI && git checkout v0.3.33 \ && pip install -r requirements.txt

功能:

  • 安装Node.js 16.x
  • 克隆ComfyUI仓库
  • 安装Python依赖

3. 构建ComfyUI插件镜像(plugins) (3_plugins/Dockerfile)

FROM ccr.ccs.tencentyun.com/b-b-x.cnb/comfyui:main # 安装额外Python包 RUN pip install \ opencv-python moviepy streamlit mediapipe \ onnxruntime-gpu OpenEXR # 安装自定义节点 WORKDIR /opt/ComfyUI COPY install_custom_nodes.sh custom_nodes.conf ./ RUN ./install_custom_nodes.sh

功能:

  • 安装图像处理相关Python包
  • 安装自定义节点
  • 配置启动脚本

构建指南

# 构建基础镜像 docker build -f docker/1_base/Dockerfile -t ccr.ccs.tencentyun.com/b-b-x.cnb/comfyui:base . # 构建ComfyUI基础镜像 docker build -f docker/2_comfyui/Dockerfile -t ccr.ccs.tencentyun.com/b-b-x.cnb/comfyui:main . # 构建插件镜像 docker build -f docker/3_plugins/Dockerfile -t ccr.ccs.tencentyun.com/b-b-x.cnb/comfyui:plugins .

注意事项

  1. 请替换镜像地址中的your-registry为您的实际镜像仓库地址
  2. 构建插件镜像前需要准备好:
    • install_custom_nodes.sh 安装脚本
    • custom_nodes.conf 节点配置文件
  3. 建议按顺序构建三个镜像
  4. 使用腾讯云镜像源加速构建过程