Skip to content

Commit a80c1f2

Browse files
committed
{nightly} Preload ComfyUI and run test in CI
1 parent 1965553 commit a80c1f2

File tree

3 files changed

+41
-110
lines changed

3 files changed

+41
-110
lines changed

.github/workflows/build-nightly.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish 'nightly' to Docker Hub
1+
name: Publish & Test 'nightly'
22

33
on:
44
workflow_dispatch: # Can be manually triggered
@@ -57,7 +57,23 @@ jobs:
5757
with:
5858
context: ./nightly
5959
file: ./nightly/Dockerfile
60+
build-args: |
61+
USING_GITHUB_ACTIONS=true
6062
tags: |
6163
yanwk/comfyui-boot:nightly
6264
yanwk/comfyui-boot:nightly-${{ steps.date.outputs.date }}-${{ steps.commit.outputs.short }}
6365
push: true
66+
67+
- name: Run container - List env vars
68+
run: |
69+
docker run --rm \
70+
--name show-env \
71+
yanwk/comfyui-boot:nightly \
72+
env
73+
74+
- name: Run container - Quick-Test
75+
run: |
76+
docker run --rm \
77+
--name comfyui-quick-test \
78+
-e CLI_ARGS="--quick-test-for-ci --cpu" \
79+
yanwk/comfyui-boot:nightly

nightly/Dockerfile

Lines changed: 18 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212
# Note about GCC:
1313
# Ubuntu 24.04 comes with GCC 13, so no additional config here.
1414
#
15-
# Note about env vars:
15+
# Note about environment variables:
1616
# In NVIDIA's image, there's no CUDA_HOME or CUDA_PATH.
1717
# Also, the LD_LIBRARY_PATH is intended to point to a non-existent folder.
1818
# Ref: https://gitlab.com/nvidia/container-images/cuda/-/issues/47
1919
################################################################################
2020

2121
FROM nvidia/cuda:13.0.2-cudnn-devel-ubuntu24.04
2222

23+
ARG USING_GITHUB_ACTIONS=false
24+
2325
ARG DEBIAN_FRONTEND=noninteractive
2426

2527
RUN --mount=type=cache,target=/var/cache/apt \
@@ -55,6 +57,7 @@ libpng-dev \
5557
&& rm -vrf /var/lib/apt/lists/* \
5658
&& rm -vf /usr/lib/python3.14/EXTERNALLY-MANAGED
5759

60+
################################################################################
5861
# In Ubuntu/Debian, PIP packages installed by APT were locked.
5962
# So here we install PIP in a classic way, make it easier to update.
6063
RUN --mount=type=cache,target=/root/.cache/pip \
@@ -66,6 +69,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \
6669
&& pip list \
6770
&& df -h
6871

72+
################################################################################
6973
# PyTorch
7074
# To reduce image size & single layer size, we:
7175
# 1. Install PyTorch only.
@@ -88,108 +92,26 @@ RUN --mount=type=cache,target=/root/.cache/pip \
8892
&& find /usr/local/lib/python3.14t/dist-packages/nvidia/ -mindepth 1 -maxdepth 1 -exec rm -rfv {} +
8993

9094
################################################################################
91-
# Dependencies
95+
# Bundle ComfyUI directly in /root
96+
WORKDIR /root
9297

93-
# RUN --mount=type=cache,target=/root/.cache/pip \
94-
# pip install \
95-
# accelerate \
96-
# compel \
97-
# diffusers \
98-
# fairscale \
99-
# ftfy \
100-
# imageio \
101-
# joblib \
102-
# kornia \
103-
# lark \
104-
# matplotlib \
105-
# onnxruntime-gpu \
106-
# opencv-contrib-python-headless \
107-
# pandas \
108-
# pilgram \
109-
# pillow \
110-
# pygit2 \
111-
# python-ffmpeg \
112-
# regex \
113-
# scikit-image \
114-
# scikit-learn \
115-
# scipy \
116-
# timm \
117-
# torchdiffeq \
118-
# torchmetrics \
119-
# transformers
98+
# Use latest ComfyUI (dev)
99+
RUN git clone 'https://github.com/comfyanonymous/ComfyUI.git'
120100

101+
# Install only essential dependencies for ComfyUI
121102
RUN --mount=type=cache,target=/root/.cache/pip \
122-
curl -o /root/requirements.txt \
123-
-L https://github.com/comfyanonymous/ComfyUI/raw/refs/heads/master/requirements.txt \
124-
&& awk '/^#non essential dependencies:/{exit} {print}' /root/requirements.txt > /root/essential.txt \
125-
&& pip install -r /root/essential.txt \
126-
&& pip install -r https://github.com/Comfy-Org/ComfyUI-Manager/raw/refs/heads/main/requirements.txt
127-
128-
# RUN --mount=type=cache,target=/root/.cache/pip \
129-
# pip install \
130-
# -r https://raw.githubusercontent.com/crystian/ComfyUI-Crystools/main/requirements.txt \
131-
# -r https://raw.githubusercontent.com/cubiq/ComfyUI_essentials/main/requirements.txt \
132-
# -r https://raw.githubusercontent.com/cubiq/ComfyUI_FaceAnalysis/main/requirements.txt \
133-
# -r https://raw.githubusercontent.com/cubiq/ComfyUI_InstantID/main/requirements.txt \
134-
# -r https://raw.githubusercontent.com/Fannovel16/comfyui_controlnet_aux/main/requirements.txt \
135-
# -r https://raw.githubusercontent.com/Fannovel16/ComfyUI-Frame-Interpolation/main/requirements-no-cupy.txt \
136-
# -r https://raw.githubusercontent.com/FizzleDorf/ComfyUI_FizzNodes/main/requirements.txt \
137-
# -r https://raw.githubusercontent.com/jags111/efficiency-nodes-comfyui/main/requirements.txt \
138-
# -r https://raw.githubusercontent.com/kijai/ComfyUI-KJNodes/main/requirements.txt \
139-
# -r https://raw.githubusercontent.com/ltdrdata/ComfyUI-Impact-Pack/Main/requirements.txt \
140-
# -r https://raw.githubusercontent.com/ltdrdata/ComfyUI-Impact-Subpack/main/requirements.txt \
141-
# -r https://raw.githubusercontent.com/ltdrdata/ComfyUI-Inspire-Pack/main/requirements.txt \
142-
# -r https://raw.githubusercontent.com/melMass/comfy_mtb/main/requirements.txt \
143-
# -r https://raw.githubusercontent.com/MrForExample/ComfyUI-3D-Pack/main/requirements.txt \
144-
# -r https://raw.githubusercontent.com/storyicon/comfyui_segment_anything/main/requirements.txt \
145-
# -r https://raw.githubusercontent.com/yolain/ComfyUI-Easy-Use/main/requirements.txt \
146-
# -r https://raw.githubusercontent.com/ZHO-ZHO-ZHO/ComfyUI-InstantID/main/requirements.txt \
147-
# && pip uninstall --break-system-packages --yes \
148-
# onnxruntime-gpu \
149-
# && pip --no-cache-dir install --break-system-packages \
150-
# onnxruntime-gpu \
151-
# --index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/ \
152-
# --extra-index-url https://pypi.org/simple \
153-
# && pip install \
154-
# mediapipe \
155-
# && pip list
103+
awk '/^#non essential dependencies:/{exit} {print}' /root/ComfyUI/requirements.txt > /root/requirements-essential.txt \
104+
&& pip install -r /root/requirements-essential.txt
156105

157106
################################################################################
158-
# # Build xFormers
159-
160-
# # https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/
161-
# ARG TORCH_CUDA_ARCH_LIST="5.2+PTX;6.0;6.1+PTX;7.0+PTX;7.5;8.0;8.6+PTX;8.9+PTX"
162-
163-
# # Limit max concurrent build jobs. Not set here.
164-
# ARG MAX_JOBS
165-
166-
# RUN mkdir -p /BUILD/wheels
167-
168-
# RUN --mount=type=cache,target=/root/.cache/pip \
169-
# pip install \
170-
# -r https://raw.githubusercontent.com/facebookresearch/xformers/main/requirements.txt
171-
172-
# RUN git clone --depth=1 --no-tags --recurse-submodules --shallow-submodules \
173-
# https://github.com/facebookresearch/xformers.git \
174-
# /BUILD/xformers
175-
176-
# WORKDIR /BUILD/xformers
177-
178-
# RUN --mount=type=cache,target=/root/.cache/pip \
179-
# --mount=type=cache,target=/BUILD/xformers/build \
180-
# --mount=type=cache,target=/BUILD/xformers/dist \
181-
# python3 setup.py bdist_wheel -d /BUILD/wheels
182-
183-
# RUN --mount=type=cache,target=/root/.cache/pip \
184-
# pip install /BUILD/wheels/*.whl
107+
# Clean cache to avoid GitHub Actions "No space left on device"
108+
RUN --mount=type=cache,target=/root/.cache/pip \
109+
if [ "${USING_GITHUB_ACTIONS}" = "true" ]; then \
110+
rm -rf /root/.cache/pip/* ; \
111+
fi
185112

186113
################################################################################
187-
188-
RUN du -ah /root \
189-
&& rm -rfv /root/.profile /root/.bashrc \
190-
&& rm -rfv /root/* \
191-
&& df -h
192-
114+
# Finishing
193115
USER root
194116
VOLUME /root
195117
WORKDIR /root

nightly/README.adoc

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,13 @@ https://hub.docker.com/r/yanwk/comfyui-boot/tags?name=nightly[View on <Docker Hu
66

77
## Note
88

9-
* This image won't download ComfyUI or any models. Please prepare your ComfyUI suite before running the container.
9+
* A ComfyUI repo is preloaded in this image (under `/root/ComfyUI`). And the `-v "$(pwd)"/storage:/root` is commented out in the examples below. You can uncomment it to persist your data, but then you need to prepare your ComfyUI folder first.
1010
11-
* Part of the `Dockerfile` is commented out due to CI limitation:
11+
* Only basic dependencies for running ComfyUI is installed. Otherwise the image would be too big that GitHub Actions would throw IOException.
1212
13-
** Only basic dependencies for running ComfyUI is installed. Otherwise the image would be too big that GitHub Actions would throw IOException.
13+
* `xFormers` is not installed in this image.
14+
It requires building from source in order to use it with PyTorch nightly. And building xFormers (with comprehensive build targets) on GitHub Actions would often result in halt (just for unpaid version, maybe).
1415
15-
** `xFormers` is not installed in this image.
16-
It requires building from source in order to use it with PyTorch nightly. And building xFormers (with comprehensive build targets) on GitHub Actions would often result in halt (maybe just unpaid version).
17-
18-
** If you build the image by yourself, you can uncomment the lines in `Dockerfile`, for a bigger, yet more comprehensive image.
19-
20-
## Running
21-
22-
* Don't forget to put ComfyUI in the `storage` folder.
2316
2417
.Using Docker
2518
[source,sh]
@@ -31,7 +24,7 @@ docker run -it --rm \
3124
--runtime nvidia \
3225
--gpus all \
3326
-p 8188:8188 \
34-
-v "$(pwd)"/storage:/root \
27+
# -v "$(pwd)"/storage:/root \
3528
-e CLI_ARGS="--fast --front-end-version Comfy-Org/ComfyUI_frontend@latest" \
3629
-e PIP_INDEX_URL="https://pypi.org/simple" \
3730
-e HF_ENDPOINT="https://huggingface.co" \
@@ -49,7 +42,7 @@ podman run -it --rm \
4942
--security-opt label=disable \
5043
--security-opt seccomp=unconfined \
5144
-p 8188:8188 \
52-
-v "$(pwd)"/storage:/root \
45+
# -v "$(pwd)"/storage:/root \
5346
-e CLI_ARGS="--fast --front-end-version Comfy-Org/ComfyUI_frontend@latest" \
5447
-e PIP_INDEX_URL="https://pypi.org/simple" \
5548
-e HF_ENDPOINT="https://huggingface.co" \

0 commit comments

Comments
 (0)