Skip to content

Commit 5165cf4

Browse files
author
yinsu.zs
committed
feat(comfyui): 升级到 ComfyUI v0.19.4 并整理构建与插件配置
将 ComfyUI 核心钉到 v0.19.4,修正 Dockerfile 构建上下文与 pip 安装顺序;Makefile 对齐 v0.19.4 镜像与 OSS v0.19.4-alpha 上传及 LEGACY_SEED 种子拷贝。 custom_nodes.json 批量调整插件钉扎(短 SHA 等);新增 update_custom_nodes_versions.py 与 README 说明;根 Makefile 支持向 agent 构建传入 COMFYUI_IMAGE;Agent 默认 COMFYUI 基础镜像 ARG 更新。 Change-Id: I1015fc870ff9afabc1321fd6e6c307fda65e4e4d Co-developed-by: Cursor <noreply@cursor.com>
1 parent f5a0ce2 commit 5165cf4

7 files changed

Lines changed: 276 additions & 59 deletions

File tree

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ release:
4545
# ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
4646
# Agent镜像相关
4747
# 镜像构建
48+
# 可选: COMFYUI_IMAGE=... 传给 agent 的 docker build
49+
COMFYUI_BUILD_ARGS := $(if $(strip $(COMFYUI_IMAGE)),--build-arg COMFYUI_IMAGE=$(COMFYUI_IMAGE),)
4850
.PHONY: build
4951
build:
50-
cd src/code/agent && docker build --platform linux/amd64 -t $(AGENT_IMAGE) .
52+
cd src/code/agent && docker build --platform linux/amd64 $(COMFYUI_BUILD_ARGS) -t $(AGENT_IMAGE) .
5153
docker tag $(AGENT_IMAGE) agent
5254

5355
# 本地测试运行

src/code/agent/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG COMFYUI_IMAGE=cap-demo-public-registry.cn-hangzhou.cr.aliyuncs.com/aliyunfc/funart-comfyui:v1.6.5
1+
ARG COMFYUI_IMAGE=cap-demo-public-registry.cn-hangzhou.cr.aliyuncs.com/cap-app/image-generation-comfyui-agent:v1.3.10
22
FROM ${COMFYUI_IMAGE} AS comfyui_source
33

44
FROM python:3.10.16-slim

src/code/comfyui/Dockerfile

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ ENV COMFYUI_DIR="/root/comfyui"
99

1010
RUN git clone https://github.com/comfyanonymous/ComfyUI.git ${COMFYUI_DIR} && \
1111
cd ${COMFYUI_DIR} && \
12-
git checkout "v0.3.77"
12+
git checkout "v0.19.4"
1313

1414
# 复制插件列表配置文件
15-
COPY code/comfyui/custom_nodes_config/custom_nodes.json /tmp/custom_nodes.json
15+
COPY comfyui/custom_nodes_config/custom_nodes.json /tmp/custom_nodes.json
1616

1717
# 批量安装自定义节点插件
1818
# 从 custom_nodes.json 读取插件列表,循环安装启用的插件
@@ -80,16 +80,18 @@ RUN cd ${COMFYUI_DIR}/custom_nodes && \
8080
fi
8181

8282
# 拷贝自研插件(如果有)
83-
COPY code/comfyui/custom_nodes/ ${COMFYUI_DIR}/custom_nodes/
83+
COPY comfyui/custom_nodes/ ${COMFYUI_DIR}/custom_nodes/
8484

8585
FROM python:3.10.16-slim AS dependencies
8686

8787
WORKDIR /root
8888

89-
# 安装系统依赖(git 等,PIPInstaller 可能需要
89+
# 安装系统依赖(git、ffmpeg:ComfyUI>=0.19 的 PyAV/av 与部分插件构建需要
9090
RUN \
9191
apt update && \
92-
apt install -y --no-install-recommends git && \
92+
apt install -y --no-install-recommends \
93+
git ffmpeg pkg-config \
94+
build-essential cmake && \
9395
rm -rf /var/lib/apt/lists/*
9496

9597
# 升级pip并初始化venv虚拟环境
@@ -108,15 +110,16 @@ COPY --from=codes ${COMFYUI_DIR} ${COMFYUI_DIR}
108110
RUN --mount=type=cache,target=/root/.cache/pip \
109111
cd ${COMFYUI_DIR} && \
110112
if [ -f requirements.txt ]; then \
111-
/root/venv/bin/pip install -r requirements.txt --no-cache-dir; \
113+
/root/venv/bin/pip install -r requirements.txt --no-cache-dir \
114+
--extra-index-url https://download.pytorch.org/whl/cu128; \
112115
else \
113116
echo "警告: ${COMFYUI_DIR}/requirements.txt 不存在"; \
114117
fi
115118

116119
# 安装 ComfyUI 插件的依赖
117120
# 使用 ManagementService.install_custom_nodes - 智能合并依赖,处理冲突(需要 agent 代码)
118121
ENV AGENT_DIR="/root/agent"
119-
COPY code/agent ${AGENT_DIR}
122+
COPY agent ${AGENT_DIR}
120123

121124
# 安装 agent 的依赖(供 ManagementService 运行,使用主 Python 环境)
122125
RUN --mount=type=cache,target=/root/.cache/pip \
@@ -132,10 +135,9 @@ RUN --mount=type=cache,target=/root/.cache/pip \
132135

133136
# 重新安装 ComfyUI 依赖以修复被插件修改的版本,并修正特定版本冲突
134137
RUN --mount=type=cache,target=/root/.cache/pip \
135-
# 重新安装 ComfyUI 依赖
136-
/root/venv/bin/pip install -r ${COMFYUI_DIR}/requirements.txt --no-cache-dir && \
137-
# 安装 transformers 依赖, transformers 5.0.0 与 comfyui0.3.77 不兼容
138-
/root/venv/bin/pip install transformers==4.56.2 --no-cache-dir && \
138+
# 与官方 requirements 一致使用 cu128 索引,避免 torch 被换成 CPU 版导致后续 wheel 失败
139+
/root/venv/bin/pip install -r ${COMFYUI_DIR}/requirements.txt --no-cache-dir \
140+
--extra-index-url https://download.pytorch.org/whl/cu128 && \
139141
/root/venv/bin/pip install setproctitle dill scikit-image -i https://mirrors.bfsu.edu.cn/pypi/web/simple/ && \
140142
# /root/venv/bin/pip install flash_attn && \
141143
# 再次强制安装指定版本的 PyTorch,防止被插件依赖覆盖
@@ -161,7 +163,7 @@ RUN \
161163
git curl wget jq ffmpeg gcc g++ build-essential zstd && \
162164
rm -rf /var/lib/apt/lists/*
163165

164-
COPY code/agent ${AGENT_DIR}
166+
COPY agent ${AGENT_DIR}
165167

166168
RUN python3 -m venv ${AGENT_DIR}/venv
167169

@@ -187,6 +189,9 @@ COPY --from=dependencies ${VENV_DIR} ${VENV_DIR}
187189
COPY --from=codes ${COMFYUI_DIR} ${COMFYUI_DIR}
188190
COPY --from=agent ${AGENT_DIR} ${AGENT_DIR}
189191

192+
# 与 aliyunfc/funart-comfyui 约定一致:agent 镜像构建时会 COPY --from=COMFYUI_IMAGE /root/built-in/custom_nodes
193+
RUN mkdir -p /root/built-in && cp -a "${COMFYUI_DIR}/custom_nodes" /root/built-in/custom_nodes
194+
190195
ENV BACKEND_TYPE="comfyui"
191196

192197
RUN chmod +x ${AGENT_DIR}/entrypoint.bash

src/code/comfyui/Makefile

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# 定义变量
22
REGION ?= cn-hangzhou
3-
COMFYUI_IMAGE = comfyui:v1.6.5
4-
COMFYUI_DEEPGPU_IMAGE = comfyui:deepgpu-v1.6.5-v1
3+
COMFYUI_IMAGE = comfyui:v0.19.4
4+
COMFYUI_DEEPGPU_IMAGE = comfyui:deepgpu-v0.19.4-v1
55
OSS_BUCKET ?= dipper-cache-$(REGION)
6-
OSS_COMFYUI_BASE_DIR = base/comfyui/v0.3.77-gamma
7-
OSS_COMFYUI_DEEPGPU_BASE_DIR = base/comfyui/v0.3.77-gamma-deepgpu
6+
OSS_COMFYUI_BASE_DIR = base/comfyui/v0.19.4-alpha
7+
OSS_COMFYUI_DEEPGPU_BASE_DIR = base/comfyui/v0.19.4-alpha-deepgpu
8+
# 上传新基线时,从旧基线拷贝 input/models(若你们 OSS 上旧路径不同,可 make OSS_COMFYUI_LEGACY_SEED=base/comfyui/xxx)
9+
OSS_COMFYUI_LEGACY_SEED ?= base/comfyui/v0.3.77-gamma
810

911
.PHONY: upgrade
1012
upgrade: build upload-base
@@ -58,16 +60,16 @@ upload-base:
5860

5961
@echo "Creating .funart/VERSION.txt..."
6062
@mkdir -p ./tmp/.funart
61-
@echo "1.6.5" > ./tmp/.funart/dependency_version.txt
63+
@echo "0.19.4" > ./tmp/.funart/dependency_version.txt
6264

6365
@echo "Uploading files to OSS..."
6466
ossutil cp -r ./tmp/models oss://$(OSS_BUCKET)/$(OSS_COMFYUI_BASE_DIR)/models && \
6567
ossutil cp -r ./tmp/custom_nodes oss://$(OSS_BUCKET)/$(OSS_COMFYUI_BASE_DIR)/custom_nodes && \
6668
ossutil cp ./tmp/comfyui.tar.zst oss://$(OSS_BUCKET)/$(OSS_COMFYUI_BASE_DIR)/snapshots/$(SNAPSHOT_NAME)/comfyui.tar.zst && \
6769
ossutil cp ./tmp/venv.tar.zst oss://$(OSS_BUCKET)/$(OSS_COMFYUI_BASE_DIR)/snapshots/$(SNAPSHOT_NAME)/venv.tar.zst && \
6870
ossutil cp ./tmp/.funart/dependency_version.txt oss://$(OSS_BUCKET)/$(OSS_COMFYUI_BASE_DIR)/.funart/dependency_version.txt && \
69-
# 将 input 目录拷贝到 OSS
70-
ossutil cp -r oss://$(OSS_BUCKET)/v0.3.77-alpha/input/ oss://$(OSS_BUCKET)/$(OSS_COMFYUI_BASE_DIR)/
71+
# 将 input 目录从旧基线拷贝到新基线 OSS(源路径不存在时请先调整 OSS_COMFYUI_LEGACY_SEED)
72+
ossutil cp -r oss://$(OSS_BUCKET)/$(OSS_COMFYUI_LEGACY_SEED)/input/ oss://$(OSS_BUCKET)/$(OSS_COMFYUI_BASE_DIR)/input/
7173

7274
@rm -rf tmp
7375
@echo "Upload completed successfully"
@@ -98,16 +100,16 @@ upload-deepgpu-base:
98100

99101
@echo "Creating .funart/VERSION.txt..."
100102
@mkdir -p ./tmp/.funart
101-
@echo "1.6.5" > ./tmp/.funart/dependency_version.txt
103+
@echo "0.19.4" > ./tmp/.funart/dependency_version.txt
102104

103105
@echo "Uploading files to OSS..."
104106
ossutil cp -r ./tmp/custom_nodes oss://$(OSS_BUCKET)/$(OSS_COMFYUI_DEEPGPU_BASE_DIR)/custom_nodes && \
105107
ossutil cp ./tmp/comfyui.tar.zst oss://$(OSS_BUCKET)/$(OSS_COMFYUI_DEEPGPU_BASE_DIR)/snapshots/$(SNAPSHOT_NAME)/comfyui.tar.zst && \
106108
ossutil cp ./tmp/venv.tar.zst oss://$(OSS_BUCKET)/$(OSS_COMFYUI_DEEPGPU_BASE_DIR)/snapshots/$(SNAPSHOT_NAME)/venv.tar.zst && \
107109
ossutil cp ./tmp/.funart/dependency_version.txt oss://$(OSS_BUCKET)/$(OSS_COMFYUI_DEEPGPU_BASE_DIR)/.funart/dependency_version.txt && \
108-
# input 目录拷贝到 OSS 上
109-
ossutil cp -r oss://$(OSS_BUCKET)/v0.3.77-alpha/input/ oss://$(OSS_BUCKET)/$(OSS_COMFYUI_DEEPGPU_BASE_DIR)/ && \
110-
ossutil cp -r oss://$(OSS_BUCKET)/v0.3.77-alpha/models/ oss://$(OSS_BUCKET)/$(OSS_COMFYUI_DEEPGPU_BASE_DIR)/
110+
# 从旧基线拷贝 input / models 到新 deepgpu 基线路径
111+
ossutil cp -r oss://$(OSS_BUCKET)/$(OSS_COMFYUI_LEGACY_SEED)/input/ oss://$(OSS_BUCKET)/$(OSS_COMFYUI_DEEPGPU_BASE_DIR)/ && \
112+
ossutil cp -r oss://$(OSS_BUCKET)/$(OSS_COMFYUI_LEGACY_SEED)/models/ oss://$(OSS_BUCKET)/$(OSS_COMFYUI_DEEPGPU_BASE_DIR)/
111113

112114
@rm -rf tmp
113115
@echo "Upload completed successfully"

src/code/comfyui/custom_nodes_config/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
| 文件 | 类型 | 用途 |
1010
|------|------|------|
1111
| `get_topn.py` | 脚本 | 从网络拉取最新数据,生成 Top N 插件列表 |
12+
| `update_custom_nodes_versions.py` | 脚本 | 批量解析各插件仓库的 Git 引用,回写 `custom_nodes.json` 中的 `version` |
1213
| `custom_nodes.json` | 配置 | 镜像内置核心插件列表(49 个) |
1314
| `excluded_custom_nodes.json` | 配置 | 排除列表,记录不内置的插件及原因 |
1415
| `custom_nodes_top100.json` | 数据 | 按 Stars 排序的 Top 100 插件列表 |
@@ -135,6 +136,29 @@ cp custom_nodes_config/custom_nodes_top_150_2026-03-05.json \
135136

136137
---
137138

139+
## update_custom_nodes_versions.py — 批量更新插件 `version`
140+
141+
**`git ls-remote`** 查远程仓库(不克隆),按规则算出新的 `version` 写回 **`custom_nodes.json`**。镜像构建里会对 `version`**`git checkout`**`latest` / 空串除外),所以跑完脚本等于批量换钉的版本。
142+
143+
**当前 `version` 怎么被改写:**
144+
145+
| 你写的 `version` | 脚本会改成 |
146+
|------------------|------------|
147+
| `latest` 或空 | 远程默认分支最新提交的 **SHA 前 12 位** |
148+
| 其它(commit 前缀、tag 名、任意占位字符串等) | 远程若有 **semver 标签**,则改成 **版本号最大的 tag**;否则改成默认分支 **SHA 前 12 位** |
149+
150+
说明:配置里只保留 **短 commit****版本号 tag** 即可;不要写分支名 `main` / `master`,否则也会按上表第二行被解析成 **tag 或 SHA**
151+
152+
依赖:**本机 `git`**、Python **`packaging`**`pip install packaging`)。默认并行 8 个仓库;有解析失败的条目会跳过并 **退出码 1**
153+
154+
```bash
155+
cd custom_nodes_config
156+
python3 update_custom_nodes_versions.py # 写回 custom_nodes.json
157+
python3 update_custom_nodes_versions.py --dry-run # 只看变更,不写文件
158+
```
159+
160+
---
161+
138162
## 相关设计文档
139163

140164
详细的系统插件架构设计请参考:[系统插件设计文档](../../../system-plugins-design.md)

0 commit comments

Comments
 (0)