Skip to content

armgit / ODS

Public Imported from GitHub
0

ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.

fix(comfyui): truthful image-generation metadata and a reproducible NVIDIA image (#8191)

Mike Bradley9f61946f30b4
diff --git a/.github/workflows/comfyui-image.yml b/.github/workflows/comfyui-image.yml
new file mode 100644
index 000000000..dee20bc78
--- /dev/null
+++ b/.github/workflows/comfyui-image.yml
@@ -0,0 +1,59 @@
+name: ComfyUI image
+# Builds the NVIDIA ComfyUI image (ods/extensions/services/comfyui/Dockerfile)
+# the way an install or an Extensions add does. The build itself fails when a
+# custom node's requirements fail, a node requirement replaces the pinned
+# torch, or any custom node fails to import (checked on the CPU; no GPU here).
+# The weekly run catches an upstream package or node that moved before an
+# owner's build does.
+on:
+ pull_request:
+ paths:
+ - 'ods/extensions/services/comfyui/Dockerfile'
+ - 'ods/extensions/services/comfyui/constraints.txt'
+ - 'ods/extensions/services/comfyui/startup.sh'
+ - 'ods/tests/test_comfyui_image.py'
+ - '.github/workflows/comfyui-image.yml'
+ push:
+ branches: [main]
+ paths:
+ - 'ods/extensions/services/comfyui/Dockerfile'
+ - 'ods/extensions/services/comfyui/constraints.txt'
+ - 'ods/extensions/services/comfyui/startup.sh'
+ - 'ods/tests/test_comfyui_image.py'
+ - '.github/workflows/comfyui-image.yml'
+ schedule:
+ - cron: '41 4 * * 1'
+ workflow_dispatch:
+permissions:
+ contents: read
+concurrency:
+ group: comfyui-image-${{ github.ref }}
+ cancel-in-progress: true
+jobs:
+ image:
+ name: NVIDIA image (amd64)
+ runs-on: ubuntu-24.04
+ timeout-minutes: 90
+ steps:
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
+ with:
+ persist-credentials: false
+ - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
+ with:
+ python-version: '3.12'
+ - name: Free runner disk for the CUDA image
+ # The CUDA 12.8 base plus the CUDA PyTorch wheels need more space than
+ # a fresh runner leaves free; these preinstalled toolchains are unused.
+ run: |
+ df -h /
+ sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
+ df -h /
+ - name: Install test runner
+ run: python -m pip install 'pytest>=8,<9'
+ - name: Build the image and check what it ships
+ env:
+ ODS_TEST_COMFYUI_IMAGE: '1'
+ ODS_TEST_COMFYUI_IIDFILE: ${{ runner.temp }}/comfyui-image-id
+ run: python -m pytest -q -s ods/tests/test_comfyui_image.py
+ - name: Report image size
+ run: docker image inspect --format 'image {{.Architecture}} {{.Size}} bytes' "$(cat "$RUNNER_TEMP/comfyui-image-id")"
diff --git a/ods/.env.example b/ods/.env.example
index 0e2fb88c7..90d0c8948 100644
--- a/ods/.env.example
+++ b/ods/.env.example
@@ -484,6 +484,12 @@ LANGFUSE_INIT_USER_PASSWORD=
# Image generation (ComfyUI + SDXL Lightning)
# ENABLE_IMAGE_GENERATION=true
+# Open WebUI reads these each time it starts; the defaults match the bundled
+# ComfyUI and the SDXL Lightning 4-step checkpoint the installer downloads.
+# COMFYUI_BASE_URL=http://comfyui:8188
+# IMAGE_GENERATION_MODEL=sdxl_lightning_4step.safetensors
+# IMAGE_SIZE=1024x1024
+# IMAGE_STEPS=4
# ═══════════════════════════════════════════════════════════════════
# Agent Policy Engine (APE)
diff --git a/ods/.env.schema.json b/ods/.env.schema.json
index f4d9d2d3c..764816b2d 100644
--- a/ods/.env.schema.json
+++ b/ods/.env.schema.json
@@ -1635,6 +1635,29 @@
"description": "Enable image generation in Open WebUI (requires ComfyUI)",
"default": "true"
},
+ "COMFYUI_BASE_URL": {
+ "type": "string",
+ "description": "ComfyUI address Open WebUI sends image prompts to (the bundled ComfyUI is http://comfyui:8188)",
+ "default": "http://comfyui:8188"
+ },
+ "IMAGE_GENERATION_MODEL": {
+ "type": "string",
+ "description": "ComfyUI checkpoint for Open WebUI's built-in SDXL workflow",
+ "default": "sdxl_lightning_4step.safetensors"
+ },
+ "IMAGE_SIZE": {
+ "type": "string",
+ "description": "Open WebUI image size as WIDTHxHEIGHT",
+ "default": "1024x1024",
+ "pattern": "^[1-9][0-9]{1,4}x[1-9][0-9]{1,4}$"
+ },
+ "IMAGE_STEPS": {
+ "type": "integer",
+ "description": "Open WebUI image sampling steps (SDXL Lightning 4-step is tuned for 4)",
+ "default": 4,
+ "minimum": 1,
+ "maximum": 150
+ },
"GPU_COUNT": {
"type": "integer",
"description": "Number of GPUs detected at install time",
diff --git a/ods/config/extensions-catalog.json b/ods/config/extensions-catalog.json
index fe7ba705f..d51c87899 100644
--- a/ods/config/extensions-catalog.json
+++ b/ods/config/extensions-catalog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-10-23T23:19:02Z",
+ "generated_at": "2026-10-26T00:13:51Z",
"schema_version": "1.0.0",
"extensions": [
{
@@ -1247,7 +1247,7 @@
{
"id": "comfyui",
"name": "ComfyUI (Image Generation)",
- "description": "Generate images with FLUX.1 via ComfyUI",
+ "description": "Generate images with SDXL Lightning via ComfyUI",
"category": "optional",
"gpu_backends": [
"amd",
@@ -1264,19 +1264,19 @@
{
"id": "images",
"name": "Image Generation",
- "description": "Generate images with FLUX.1 via ComfyUI",
+ "description": "Generate images with SDXL Lightning via ComfyUI",
"icon": "Image",
"category": "creative",
"requirements": {
"services": [
"comfyui"
],
- "vram_gb": 0
+ "vram_gb": 8
},
"enabled_services_all": [
"comfyui"
],
- "setup_time": "Ready",
+ "setup_time": "Image build or download and a 6.9 GB model; see README",
"priority": 5,
"launch": {
"type": "service",
diff --git a/ods/docker-compose.base.yml b/ods/docker-compose.base.yml
index eed8d48ae..af4c32d33 100644
--- a/ods/docker-compose.base.yml
+++ b/ods/docker-compose.base.yml
@@ -199,10 +199,12 @@ services:
# users would otherwise hit a missing-engine error from Open WebUI.
ENABLE_IMAGE_GENERATION: "${ENABLE_IMAGE_GENERATION:-false}"
IMAGE_GENERATION_ENGINE: "comfyui"
- COMFYUI_BASE_URL: "http://comfyui:8188"
- IMAGE_SIZE: "1024x1024"
- IMAGE_STEPS: "4"
- IMAGE_GENERATION_MODEL: "sdxl_lightning_4step.safetensors"
+ # Owner-settable in .env (Settings applies them by recreating Open WebUI).
+ # The workflow below stays fixed; IMAGE_GENERATION_MODEL fills its loader.
+ COMFYUI_BASE_URL: "${COMFYUI_BASE_URL:-http://comfyui:8188}"
+ IMAGE_SIZE: "${IMAGE_SIZE:-1024x1024}"
+ IMAGE_STEPS: "${IMAGE_STEPS:-4}"
+ IMAGE_GENERATION_MODEL: "${IMAGE_GENERATION_MODEL:-sdxl_lightning_4step.safetensors}"
COMFYUI_WORKFLOW: >-
{"3":{"inputs":{"seed":42,"steps":4,"cfg":1.5,"sampler_name":"euler","scheduler":"sgm_uniform","denoise":1.0,"model":["4",0],"positive":["6",0],"negative":["7",0],"latent_image":["5",0]},"class_type":"KSampler"},
"4":{"inputs":{"ckpt_name":"sdxl_lightning_4step.safetensors"},"class_type":"CheckpointLoaderSimple"},
diff --git a/ods/extensions/library/workflows/comfyui/README.md b/ods/extensions/library/workflows/comfyui/README.md
index fd949e41f..7fdd25343 100644
--- a/ods/extensions/library/workflows/comfyui/README.md
+++ b/ods/extensions/library/workflows/comfyui/README.md
@@ -21,11 +21,14 @@ Best for consistent, high-quality image generation with prompt engineering.
- `LLM_HOST` - LLM server host (default: localhost)
- `LLM_PORT` - LLM port (default: 8080)
-- `COMFYUI_HOST` - ComfyUI host (default: localhost)
+- `COMFYUI_HOST` - ComfyUI host (default: comfyui, the bundled service on the ODS network)
- `COMFYUI_PORT` - ComfyUI port (default: 8188)
-- `COMFYUI_MODEL_NAME` - ComfyUI model name (default: flux1-dev.safetensors)
+- `COMFYUI_MODEL_NAME` - ComfyUI checkpoint (default: sdxl_lightning_4step.safetensors, the model ODS downloads)
- `LLM_TO_IMAGE_API_KEY` - Optional API key for webhook authentication
+The built-in sampler settings (4 steps, CFG 1.5, `euler` with `sgm_uniform`) are tuned for SDXL Lightning 4-step.
+Change them in the "Queue Image Generation" node if you point `COMFYUI_MODEL_NAME` at a different checkpoint.
+
#### Usage
```bash
@@ -54,7 +57,7 @@ Best when you want the LLM to adapt the ComfyUI workflow structure based on the
- `LLM_HOST` - LLM server host (default: localhost)
- `LLM_API_PORT` - LLM API port (default: 8080)
-- `COMFYUI_HOST` - ComfyUI host (default: localhost)
+- `COMFYUI_HOST` - ComfyUI host (default: comfyui, the bundled service on the ODS network)
- `COMFYUI_PORT` - ComfyUI port (default: 8188)
- `COMFYUI_DYNAMIC_API_KEY` - Optional API key for webhook authentication
diff --git a/ods/extensions/library/workflows/comfyui/llm-image-gen.json b/ods/extensions/library/workflows/comfyui/llm-image-gen.json
index feb7716ab..c2463bb5c 100644
--- a/ods/extensions/library/workflows/comfyui/llm-image-gen.json
+++ b/ods/extensions/library/workflows/comfyui/llm-image-gen.json
@@ -60,7 +60,7 @@
},
{
"parameters": {
- "url": "={{ 'http://' + ($env.COMFYUI_HOST || 'localhost') + ':' + ($env.COMFYUI_PORT || '8188') + '/prompt' }}",
+ "url": "={{ 'http://' + ($env.COMFYUI_HOST || 'comfyui') + ':' + ($env.COMFYUI_PORT || '8188') + '/prompt' }}",
"method": "POST",
"headers": {
"list": [
diff --git a/ods/extensions/library/workflows/comfyui/llm-to-image.json b/ods/extensions/library/workflows/comfyui/llm-to-image.json
index b96493519..2d2aa07da 100644
--- a/ods/extensions/library/workflows/comfyui/llm-to-image.json
+++ b/ods/extensions/library/workflows/comfyui/llm-to-image.json
@@ -67,7 +67,7 @@
}
]
},
- "body": "={{ {\n \"model\": $env.LLM_MODEL || 'default',\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an AI image generation assistant. Convert the user's text description into a detailed, artistic image generation prompt for ComfyUI/FLUX. Include style, lighting, composition, and artistic details. Keep it under 500 characters.\"\n },\n {\n \"role\": \"user\",\n \"content\": $('Validate Input').first().json.prompt\n }\n ],\n \"max_tokens\": 500,\n \"temperature\": 0.7\n} }}",
+ "body": "={{ {\n \"model\": $env.LLM_MODEL || 'default',\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"You are an AI image generation assistant. Convert the user's text description into a detailed, artistic image generation prompt for ComfyUI (SDXL Lightning). Include style, lighting, composition, and artistic details. Keep it under 500 characters.\"\n },\n {\n \"role\": \"user\",\n \"content\": $('Validate Input').first().json.prompt\n }\n ],\n \"max_tokens\": 500,\n \"temperature\": 0.7\n} }}",
"options": {
"timeout": 60000
}
@@ -92,7 +92,7 @@
},
{
"parameters": {
- "url": "={{ 'http://' + ($env.COMFYUI_HOST || 'localhost') + ':' + ($env.COMFYUI_PORT || '8188') + '/prompt' }}",
+ "url": "={{ 'http://' + ($env.COMFYUI_HOST || 'comfyui') + ':' + ($env.COMFYUI_PORT || '8188') + '/prompt' }}",
"method": "POST",
"headers": {
"list": [
@@ -102,7 +102,7 @@
}
]
},
- "body": "={{ {\n \"prompt\": {\n \"3\": {\n \"inputs\": {\n \"seed\": Math.floor(Math.random() * 9999999999),\n \"steps\": 20,\n \"cfg\": 8.0,\n \"sampler_name\": \"euler\",\n \"scheduler\": \"normal\",\n \"denoise\": 1.0,\n \"model\": [\"4\", 0],\n \"positive\": [\"6\", 0],\n \"negative\": [\"7\", 0],\n \"latent_image\": [\"5\", 0]\n },\n \"class_type\": \"KSampler\"\n },\n \"4\": {\n \"inputs\": {\n \"ckpt_name\": $env.COMFYUI_MODEL_NAME || 'flux1-dev.safetensors'\n },\n \"class_type\": \"CheckpointLoaderSimple\"\n },\n \"5\": {\n \"inputs\": {\n \"width\": 1024,\n \"height\": 1024,\n \"batch_size\": 1\n },\n \"class_type\": \"EmptyLatentImage\"\n },\n \"6\": {\n \"inputs\": {\n \"text\": $('Process LLM Response').first().json.enhanced_prompt,\n \"clip\": [\"4\", 1]\n },\n \"class_type\": \"CLIPTextEncode\"\n },\n \"7\": {\n \"inputs\": {\n \"text\": \"text, watermark, blurry, low quality\",\n \"clip\": [\"4\", 1]\n },\n \"class_type\": \"CLIPTextEncode\"\n },\n \"8\": {\n \"inputs\": {\n \"samples\": [\"3\", 0],\n \"vae\": [\"4\", 2]\n },\n \"class_type\": \"VAEDecode\"\n },\n \"9\": {\n \"inputs\": {\n \"filename_prefix\": 'llm_to_image_' + new Date().getTime(),\n \"images\": [\"8\", 0]\n },\n \"class_type\": \"SaveImage\"\n }\n },\n \"client_id\": 'n8n_llm_to_image_' + new Date().getTime()\n} }}",
+ "body": "={{ {\n \"prompt\": {\n \"3\": {\n \"inputs\": {\n \"seed\": Math.floor(Math.random() * 9999999999),\n \"steps\": 4,\n \"cfg\": 1.5,\n \"sampler_name\": \"euler\",\n \"scheduler\": \"sgm_uniform\",\n \"denoise\": 1.0,\n \"model\": [\"4\", 0],\n \"positive\": [\"6\", 0],\n \"negative\": [\"7\", 0],\n \"latent_image\": [\"5\", 0]\n },\n \"class_type\": \"KSampler\"\n },\n \"4\": {\n \"inputs\": {\n \"ckpt_name\": $env.COMFYUI_MODEL_NAME || 'sdxl_lightning_4step.safetensors'\n },\n \"class_type\": \"CheckpointLoaderSimple\"\n },\n \"5\": {\n \"inputs\": {\n \"width\": 1024,\n \"height\": 1024,\n \"batch_size\": 1\n },\n \"class_type\": \"EmptyLatentImage\"\n },\n \"6\": {\n \"inputs\": {\n \"text\": $('Process LLM Response').first().json.enhanced_prompt,\n \"clip\": [\"4\", 1]\n },\n \"class_type\": \"CLIPTextEncode\"\n },\n \"7\": {\n \"inputs\": {\n \"text\": \"text, watermark, blurry, low quality\",\n \"clip\": [\"4\", 1]\n },\n \"class_type\": \"CLIPTextEncode\"\n },\n \"8\": {\n \"inputs\": {\n \"samples\": [\"3\", 0],\n \"vae\": [\"4\", 2]\n },\n \"class_type\": \"VAEDecode\"\n },\n \"9\": {\n \"inputs\": {\n \"filename_prefix\": 'llm_to_image_' + new Date().getTime(),\n \"images\": [\"8\", 0]\n },\n \"class_type\": \"SaveImage\"\n }\n },\n \"client_id\": 'n8n_llm_to_image_' + new Date().getTime()\n} }}",
"options": {
"timeout": 120000
}
@@ -140,7 +140,7 @@
{
"parameters": {
"channel": "={{ $('Validate Input').first().json.channel || 'general' }}",
- "text": "={{ '*Image Generation Failed* ❌\\n\\n**Error:** ' + (($json.error || $input.all()[0]?.error?.message || $input.all()[0]?.error?.description || 'Unknown error')).toString().slice(0, 997).trimEnd() + '\\n\\nPlease check:\\n- LLM service is running\\n- ComfyUI service is running\\n- FLUX.1 model is loaded\\n- API keys are correct (if configured)' }}"
+ "text": "={{ '*Image Generation Failed* ❌\\n\\n**Error:** ' + (($json.error || $input.all()[0]?.error?.message || $input.all()[0]?.error?.description || 'Unknown error')).toString().slice(0, 997).trimEnd() + '\\n\\nPlease check:\\n- LLM service is running\\n- ComfyUI service is running\\n- sdxl_lightning_4step.safetensors is in ComfyUI's checkpoints folder\\n- API keys are correct (if configured)' }}"
},
"id": "discord-error",
"name": "Discord Error",
diff --git a/ods/extensions/services/comfyui/Dockerfile b/ods/extensions/services/comfyui/Dockerfile
index d5060dd98..ddf175158 100644
--- a/ods/extensions/services/comfyui/Dockerfile
+++ b/ods/extensions/services/comfyui/Dockerfile
@@ -1,14 +1,18 @@
# =============================================================================
-# ComfyUI Production Image — SDXL Lightning + NVFP4 Acceleration
+# ComfyUI Production Image — NVIDIA CUDA 12.8 (x86-64), SDXL Lightning
#
# Layers ordered for optimal Docker cache:
# 1. System deps (rarely changes)
-# 2. PyTorch + CUDA (rarely changes)
-# 3. ComfyUI from source
-# 4. ComfyUI-Manager
-# 5. Custom nodes (each = own RUN for granular caching)
-# 6. comfy-kitchen NVFP4 acceleration
+# 2. PyTorch + CUDA (pinned, rarely changes)
+# 3. ComfyUI from source (pinned tag)
+# 4. Custom nodes (each = own RUN for granular caching, pinned commits)
+# 5. comfy-kitchen NVFP4 acceleration
+# 6. Build checks: pinned torch kept, every custom node imports
# 7. Startup script + non-root user (changes most often)
+#
+# ComfyUI-Manager is not installed. Its checkout never loaded as a custom node
+# under ComfyUI 0.16.4 (that release expects the comfyui_manager package and
+# --enable-manager), and nodes it installed would not survive a recreate.
# =============================================================================
FROM nvidia/cuda:12.8.0-runtime-ubuntu22.04@sha256:b0e5afeabc356a9c41148c50f219d3117d46cb6ec23c590e3a0ebaa1db0ff946
@@ -25,11 +29,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
git wget ffmpeg libgl1 libglib2.0-0 libsm6 libxext6 libxrender1 \
&& rm -rf /var/lib/apt/lists/*
+# Every pip install below resolves to the exact package set this image was
+# tested with (constraints.txt). An ARG reaches each RUN as an environment
+# variable during the build without staying in the running image.
+COPY constraints.txt /opt/ods-comfyui-constraints.txt
+ARG PIP_CONSTRAINT=/opt/ods-comfyui-constraints.txt
+
# ---------------------------------------------------------------------------
-# Layer 2: PyTorch + CUDA 12.8 (Blackwell sm_120 support)
+# Layer 2: PyTorch + CUDA 12.8 (Blackwell sm_120 support), pinned as in
+# Dockerfile.standalone. torchaudio comes from the same index, so ComfyUI's
+# requirements below find all three already installed.
# ---------------------------------------------------------------------------
RUN pip3 install --no-cache-dir \
- torch torchvision torchaudio \
+ torch==2.11.0 torchvision==0.26.0 torchaudio==2.11.0 \
--index-url https://download.pytorch.org/whl/cu128
# ---------------------------------------------------------------------------
@@ -40,54 +52,81 @@ RUN git clone --branch v0.16.4 --depth 1 https://github.com/comfyanonymous/Comfy
&& pip3 install --no-cache-dir -r requirements.txt
# ---------------------------------------------------------------------------
-# Layer 4: ComfyUI-Manager
-# ---------------------------------------------------------------------------
-RUN cd "$COMFYUI_DIR/custom_nodes" \
- && git clone --branch 4.1b2 --depth 1 https://github.com/ltdrdata/ComfyUI-Manager.git \
- && cd ComfyUI-Manager \
- && pip3 install --no-cache-dir -r requirements.txt 2>/dev/null || true
-
-# ---------------------------------------------------------------------------
-# Layer 5a: ComfyUI-GGUF (GGUF model loading)
+# Layer 4a: ComfyUI-GGUF (GGUF model loading)
# ---------------------------------------------------------------------------
RUN cd "$COMFYUI_DIR/custom_nodes" \
&& git clone https://github.com/city96/ComfyUI-GGUF.git \
&& cd ComfyUI-GGUF \
&& git checkout 6ea2651e \
- && pip3 install --no-cache-dir -r requirements.txt 2>/dev/null || true
+ && pip3 install --no-cache-dir -r requirements.txt
# ---------------------------------------------------------------------------
-# Layer 5b: ComfyUI-KJNodes (LTX-2 node graphs)
+# Layer 4b: ComfyUI-KJNodes (LTX-2 node graphs)
# ---------------------------------------------------------------------------
RUN cd "$COMFYUI_DIR/custom_nodes" \
&& git clone https://github.com/kijai/ComfyUI-KJNodes.git \
&& cd ComfyUI-KJNodes \
&& git checkout 2747d76e \
- && pip3 install --no-cache-dir -r requirements.txt 2>/dev/null || true
+ && pip3 install --no-cache-dir -r requirements.txt
# ---------------------------------------------------------------------------
-# Layer 5c: ComfyUI-VideoHelperSuite (video output)
+# Layer 4c: ComfyUI-VideoHelperSuite (video output)
# ---------------------------------------------------------------------------
RUN cd "$COMFYUI_DIR/custom_nodes" \
&& git clone https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite.git \
&& cd ComfyUI-VideoHelperSuite \
&& git checkout 993082e4 \
- && pip3 install --no-cache-dir -r requirements.txt 2>/dev/null || true
+ && pip3 install --no-cache-dir -r requirements.txt
# ---------------------------------------------------------------------------
-# Layer 5d: ComfyUI-LTXVideo (Lightricks nodes)
+# Layer 4d: ComfyUI-LTXVideo (Lightricks nodes)
# ---------------------------------------------------------------------------
RUN cd "$COMFYUI_DIR/custom_nodes" \
&& git clone https://github.com/Lightricks/ComfyUI-LTXVideo.git \
&& cd ComfyUI-LTXVideo \
&& git checkout 531512f7 \
- && pip3 install --no-cache-dir -r requirements.txt 2>/dev/null || true
+ && pip3 install --no-cache-dir -r requirements.txt
# ---------------------------------------------------------------------------
-# Layer 6: comfy-kitchen — NVIDIA NVFP4 acceleration
+# Layer 5: comfy-kitchen — NVIDIA NVFP4 acceleration
+#
+# Its CUDA kernels need a PyTorch built for CUDA 13 (cu130, driver r580+);
+# with this cu128 build ComfyUI logs "You need pytorch with cu130 or higher"
+# and uses comfy-kitchen's eager backend instead.
# ---------------------------------------------------------------------------
RUN pip3 install --no-cache-dir "comfy-kitchen[cublas]"
+# ---------------------------------------------------------------------------
+# Layer 6: Build checks
+#
+# No node requirement may replace the pinned torch. ComfyUI then loads every
+# custom node on the CPU and exits (--quick-test-for-ci); "IMPORT FAILED",
+# "PRESTARTUP FAILED" or KJNodes' own "LTXV nodes could not be imported" (it
+# catches that error itself) fails the build. Its run state goes to scratch
+# paths and an in-memory database: the default database lives in
+# $COMFYUI_DIR/user, which startup.sh treats as an old image's user data.
+# ---------------------------------------------------------------------------
+RUN python3 -c "import torch, torchvision, torchaudio; \
+assert torch.__version__ == '2.11.0+cu128', torch.__version__; \
+assert torchvision.__version__ == '0.26.0+cu128', torchvision.__version__; \
+assert torchaudio.__version__ == '2.11.0+cu128', torchaudio.__version__" \
+ && mkdir -p /tmp/ods-quick-test/user /tmp/ods-quick-test/output \
+ /tmp/ods-quick-test/input /tmp/ods-quick-test/temp \
+ && cd "$COMFYUI_DIR" \
+ && { python3 main.py --cpu --quick-test-for-ci --disable-assets-autoscan \
+ --database-url sqlite:///:memory: \
+ --user-directory /tmp/ods-quick-test/user \
+ --output-directory /tmp/ods-quick-test/output \
+ --input-directory /tmp/ods-quick-test/input \
+ --temp-directory /tmp/ods-quick-test/temp \
+ > /tmp/ods-quick-test.log 2>&1 \
+ || { cat /tmp/ods-quick-test.log; exit 1; }; } \
+ && cat /tmp/ods-quick-test.log \
+ && ! grep -E "IMPORT FAILED|PRESTARTUP FAILED|LTXV nodes could not be imported" /tmp/ods-quick-test.log \
+ && { test ! -e "$COMFYUI_DIR/user" \
+ || { echo "The build check left $COMFYUI_DIR/user behind" >&2; exit 1; }; } \
+ && rm -rf /tmp/ods-quick-test /tmp/ods-quick-test.log
+
# ---------------------------------------------------------------------------
# Layer 7: Startup script + non-root user
# ---------------------------------------------------------------------------
diff --git a/ods/extensions/services/comfyui/README.md b/ods/extensions/services/comfyui/README.md
index d9211d71d..1d1bf861e 100644
--- a/ods/extensions/services/comfyui/README.md
+++ b/ods/extensions/services/comfyui/README.md
@@ -22,11 +22,19 @@ ComfyUI is GPU-only. The service definition is split by GPU vendor:
| Backend | Compose file | Notes |
|---------|-------------|-------|
-| NVIDIA (CUDA) | `compose.nvidia.yaml` | Requires NVIDIA Container Toolkit |
+| NVIDIA (CUDA) | `compose.nvidia.yaml` | Requires NVIDIA Container Toolkit. The image is built on the machine (x86-64, CUDA 12.8). |
| AMD (ROCm) | `compose.amd.yaml` | Runs the detected GPU's native architecture; the bundled ROCm 7.2 torch wheel includes gfx1151 and gfx1201; uses flash attention |
+The image generation feature asks for 8 GB of GPU memory: SDXL Lightning at 1024×1024. Not validated yet:
+- AMD GPUs other than gfx1151 (Strix Halo) and gfx1201 (RDNA 4);
+- Arm64 NVIDIA systems (DGX Spark, RTX Spark).
+
> **Apple Silicon:** ComfyUI is not currently configured for Apple Silicon (macOS ARM). Use the native ComfyUI application instead.
+The NVIDIA image ships a fixed set of custom nodes: ComfyUI-GGUF, ComfyUI-KJNodes, ComfyUI-VideoHelperSuite and
+ComfyUI-LTXVideo. ComfyUI-Manager is not included. Its custom-node checkout never loaded under ComfyUI 0.16.4, and
+nodes installed at run time would not survive a container recreate.
+
## Configuration
Environment variables (set in `.env`):
@@ -35,6 +43,38 @@ Environment variables (set in `.env`):
|----------|---------|-------------|
| `COMFYUI_PORT` | 8188 | External port for the ComfyUI web UI and API |
+Open WebUI's image generation reads these from `.env` each time it starts:
+
+| Variable | Default | Description |
+|----------|---------|-------------|
+| `ENABLE_IMAGE_GENERATION` | `true` when image generation was chosen at install | Shows the image button in Open WebUI chats |
+| `COMFYUI_BASE_URL` | `http://comfyui:8188` | The ComfyUI that Open WebUI sends prompts to |
+| `IMAGE_GENERATION_MODEL` | `sdxl_lightning_4step.safetensors` | Checkpoint for Open WebUI's built-in SDXL workflow |
+| `IMAGE_SIZE` | `1024x1024` | Image size |
+| `IMAGE_STEPS` | `4` | Sampling steps (SDXL Lightning 4-step is tuned for 4) |
+
+## Image model
+
+When image generation is chosen in the installer, the installer downloads SDXL Lightning 4-step
+(`sdxl_lightning_4step.safetensors`, 6.94 GB) into `checkpoints/` in the background.
+
+Adding ComfyUI later from the Extensions page does not download it yet. Fetch it once from your ODS install
+directory, then click **Refresh** in ComfyUI. On AMD the folder is `data/comfyui/ComfyUI/models/checkpoints`.
+
+If `mkdir` or `curl` reports "Permission denied" (the AMD container runs as root and owns its folder), run the commands
+with `sudo`.
+
+```bash
+dir=data/comfyui/models/checkpoints
+mkdir -p "$dir"
+curl -fL -C - -o "$dir/sdxl_lightning_4step.safetensors.part" \
+ https://huggingface.co/ByteDance/SDXL-Lightning/resolve/main/sdxl_lightning_4step.safetensors
+echo "e0d996ee0013e79d9d3561f50fcafb9a17e3ff07b780358e3b66d67932c4d490 $dir/sdxl_lightning_4step.safetensors.part" | sha256sum -c - \
+ && mv "$dir/sdxl_lightning_4step.safetensors.part" "$dir/sdxl_lightning_4step.safetensors"
+```
+
+The model is published under the CreativeML OpenRAIL++-M licence (Hugging Face `ByteDance/SDXL-Lightning`).
+
## Volume Mounts
### NVIDIA
@@ -120,22 +160,29 @@ ComfyUI ships an official workflow template for Lightricks LTX-2.3 text-to-video
### Required model files
-Place under `./data/comfyui/models/` (NVIDIA layout; for AMD use `./data/comfyui/ComfyUI/models/`). As of 2026-05-10, the official `video_ltx2_3_t2v.json` template's Model Links panel references:
+Place under `./data/comfyui/models/` (NVIDIA layout; for AMD use `./data/comfyui/ComfyUI/models/`). ComfyUI 0.16.4 ships
+workflow templates 0.9.11, whose `video_ltx2_3_t2v.json` Model Links panel references:
+
+| File | Subdirectory | Size |
+|---|---|---|
+| `ltx-2.3-22b-dev-fp8.safetensors` ([Lightricks/LTX-2.3-fp8](https://huggingface.co/Lightricks/LTX-2.3-fp8)) | `checkpoints/` | 29.15 GB |
+| `gemma_3_12B_it_fp4_mixed.safetensors` ([Comfy-Org/ltx-2](https://huggingface.co/Comfy-Org/ltx-2), `split_files/text_encoders/`) | `text_encoders/` | 9.45 GB |
+| `ltx-2.3-22b-distilled-lora-384.safetensors` ([Lightricks/LTX-2.3](https://huggingface.co/Lightricks/LTX-2.3)) | `loras/` | 7.61 GB |
+| `ltx-2.3-spatial-upscaler-x2-1.1.safetensors` ([Lightricks/LTX-2.3](https://huggingface.co/Lightricks/LTX-2.3)) | `latent_upscale_models/` | 1.00 GB |
+
+The four files take about 47 GB on disk.
-| File | Subdirectory |
-|---|---|
-| `ltx-2.3-22b-dev-fp8.safetensors` | `checkpoints/` |
-| `ltx-2.3-22b-distilled-lora-384.safetensors` | `loras/` |
-| `gemma-3-12b-it-abliterated_lora_rank64_bf16.safetensors` | `loras/` |
-| `ltx-2.3-spatial-upscaler-x2-1.1.safetensors` | `latent_upscale_models/` |
+The 0.9.11 template links `ltx-2.3-spatial-upscaler-x2-1.0.safetensors`, which Lightricks no longer publishes. Download
+`x2-1.1` instead and select it in the upscaler loader node.
-The official template links to these files on Hugging Face. If ComfyUI updates the template, trust the template's Model Links panel over older mirrored model-storage notes. Combined disk footprint is roughly 30–35 GB.
+The LTX-2.3 weights are published under the LTX-2 Community License Agreement, and the Gemma text encoder under
+Google's Gemma terms. Read both before use.
### Loading the workflow
1. Open ComfyUI at `http://localhost:8188`
2. **Workflow → Browse Templates → Video → LTX-2.3 T2V** (`video_ltx2_3_t2v.json`)
-3. Verify all four model loader nodes resolve (no red boxes)
+3. Verify all four model loader nodes resolve (no red boxes); pick the `x2-1.1` upscaler if its loader is red
### Tuning that matters
diff --git a/ods/extensions/services/comfyui/constraints.txt b/ods/extensions/services/comfyui/constraints.txt
new file mode 100644
index 000000000..b80c0c113
--- /dev/null
+++ b/ods/extensions/services/comfyui/constraints.txt
@@ -0,0 +1,138 @@
+# Exact Python packages of the NVIDIA ComfyUI image (x86-64, CUDA 12.8).
+#
+# The Dockerfile passes this file to every pip install as PIP_CONSTRAINT, so a
+# build installs the set that passed the build check and a GPU generation test
+# instead of whatever upstream published since. Refresh: build from a copy of
+# the Dockerfile without the PIP_CONSTRAINT line, run the image's GPU test, then
+# replace the pins below with that image's `pip3 freeze`.
+#
+# Source: pip3 freeze of the image built under these constraints (Dockerfile
+# 9b430de3, 2026-10-25), which generated SDXL Lightning images on an RTX 5090.
+aiohappyeyeballs==2.7.1
+aiohttp==3.14.5
+aiosignal==1.4.0
+alembic==1.20.1
+annotated-doc==0.0.5
+annotated-types==0.8.0
+anyio==4.15.1
+async-timeout==5.0.1
+attrs==26.1.0
+av==17.1.0
+certifi==2026.10.23
+charset-normalizer==3.5.2
+click==8.5.0
+color-matcher==0.6.0
+comfy-aimdo==0.6.0
+comfy-kitchen==0.2.40
+comfyui-embedded-docs==0.4.3
+comfyui-workflow-templates-core==0.3.159
+comfyui-workflow-templates-media-api==0.3.59
+comfyui-workflow-templates-media-image==0.3.98
+comfyui-workflow-templates-media-other==0.3.131
+comfyui-workflow-templates-media-video==0.3.57
+comfyui_frontend_package==1.39.19
+comfyui_workflow_templates==0.9.11
+contourpy==1.3.2
+cuda-bindings==12.9.7
+cuda-pathfinder==1.6.0
+cuda-toolkit==12.8.1
+cycler==0.12.1
+ddt==1.7.2
+diffusers==0.41.0
+docutils==0.23
+einops==0.8.2
+exceptiongroup==1.3.1
+filelock==3.32.3
+fonttools==4.65.0
+frozenlist==1.8.0
+fsspec==2026.7.0
+gguf==0.19.0
+glfw==2.11.0
+greenlet==3.5.6
+h11==0.16.0
+hf-xet==1.7.0
+httpcore==1.0.9
+httpx==0.28.1
+huggingface_hub==1.33.0
+idna==3.20
+ImageIO==2.38.0
+imageio-ffmpeg==0.6.0
+importlib_metadata==9.0.1
+Jinja2==3.1.6
+kiwisolver==1.5.1
+kornia==0.8.2
+kornia_rs==0.2.0
+Mako==1.4.3
+markdown-it-py==4.2.0
+MarkupSafe==3.0.3
+matplotlib==3.10.9
+mdurl==0.1.2
+mpmath==1.3.0
+mss==10.2.0
+multidict==7.1.0
+networkx==3.4.2
+ninja==1.11.1.4
+numpy==2.2.6
+nvidia-cublas==13.8.1.7
+nvidia-cublas-cu12==12.8.4.1
+nvidia-cuda-cupti-cu12==12.8.90
+nvidia-cuda-nvrtc==13.4.92
+nvidia-cuda-nvrtc-cu12==12.8.93
+nvidia-cuda-runtime-cu12==12.8.90
+nvidia-cudnn-cu12==9.19.0.56
+nvidia-cufft-cu12==11.3.3.83
+nvidia-cufile-cu12==1.13.1.3
+nvidia-curand-cu12==10.3.9.90
+nvidia-cusolver-cu12==11.7.3.90
+nvidia-cusparse-cu12==12.5.8.93
+nvidia-cusparselt-cu12==0.7.1
+nvidia-nccl-cu12==2.28.9
+nvidia-nvjitlink-cu12==12.8.93
+nvidia-nvshmem-cu12==3.4.5
+nvidia-nvtx-cu12==12.8.90
+opencv-python==5.0.0.93
+opencv-python-headless==5.0.0.93
+packaging==26.3
+pillow==12.3.0
+propcache==0.5.4
+protobuf==7.36.2
+psutil==7.2.2
+pydantic==2.14.1
+pydantic-settings==2.15.0
+pydantic_core==2.50.1
+Pygments==2.21.0
+PyOpenGL==3.1.10
+pyparsing==3.3.3
+python-dateutil==3.0.0
+python-dotenv==1.2.4
+PyYAML==6.0.3
+regex==2026.9.29
+requests==2.34.2
+rich==15.0.0
+safetensors==0.8.0
+scipy==1.15.3
+sentencepiece==0.2.2
+shellingham==1.5.4
+simpleeval==1.0.8
+six==1.17.0
+spandrel==0.4.2
+SQLAlchemy==2.0.55
+sympy==1.14.0
+timm==1.0.30
+tokenizers==0.23.3
+tomli==2.5.0
+torch==2.11.0+cu128
+torchaudio==2.11.0+cu128
+torchsde==0.2.6
+torchvision==0.26.0+cu128
+tqdm==4.70.1
+trampoline==0.1.2
+transformers==5.20.2
+triton==3.6.0
+typer==0.27.3
+typing-inspection==0.4.4
+typing_extensions==4.16.0
+tzdata==2026.5
+urllib3==2.8.0
+yarl==1.25.1
+zipp==4.1.2
diff --git a/ods/extensions/services/comfyui/manifest.yaml b/ods/extensions/services/comfyui/manifest.yaml
index 0081890d3..c0ae9e325 100644
--- a/ods/extensions/services/comfyui/manifest.yaml
+++ b/ods/extensions/services/comfyui/manifest.yaml
@@ -24,14 +24,16 @@ service:
features:
- id: images
name: Image Generation
- description: Generate images with FLUX.1 via ComfyUI
+ description: Generate images with SDXL Lightning via ComfyUI
icon: Image
category: creative
requirements:
services: [comfyui]
- vram_gb: 0
+ # SDXL Lightning at 1024x1024 used about 7 GB of GPU memory (RTX 5090,
+ # 2026-10-25), on top of whatever the chat model holds.
+ vram_gb: 8
enabled_services_all: [comfyui]
- setup_time: Ready
+ setup_time: Image build or download and a 6.9 GB model; see README
priority: 5
launch:
type: service
diff --git a/ods/installers/phases/12-health.sh b/ods/installers/phases/12-health.sh
index 708c37649..cbd65dd2a 100755
--- a/ods/installers/phases/12-health.sh
+++ b/ods/installers/phases/12-health.sh
@@ -455,7 +455,7 @@ if [[ "${ENABLE_PERPLEXICA:-false}" == "true" ]]; then
ods_progress 91 "health" "Waiting for Research engine"
_check_health "Perplexica" "http://127.0.0.1:${SERVICE_PORTS[perplexica]:-3004}${SERVICE_HEALTH[perplexica]:-/}" 150 10 "$(sr_container perplexica)"
fi
-# ComfyUI: 150 attempts * adaptive backoff = up to ~20 minutes (FLUX model loading is slow)
+# ComfyUI: 150 attempts * adaptive backoff = up to ~20 minutes.
if [[ "$ENABLE_COMFYUI" == "true" ]]; then
ods_progress 93 "health" "Waiting for Image generation"
_check_health "ComfyUI" "http://127.0.0.1:${SERVICE_PORTS[comfyui]:-8188}${SERVICE_HEALTH[comfyui]:-/}" 150 15 "$(sr_container comfyui)"
diff --git a/ods/tests/ci-suite.txt b/ods/tests/ci-suite.txt
index 94ef16fe2..ebf52c8e4 100644
--- a/ods/tests/ci-suite.txt
+++ b/ods/tests/ci-suite.txt
@@ -60,6 +60,7 @@ tests/test-cli-status-optional-webui.sh
tests/test-cli-stt-env.py
tests/test-cli-update-verification.sh
tests/test-comfyui-user-dir-persisted.sh
+tests/test_comfyui_extension_contract.py
tests/test-compose-failure-evidence.sh
tests/test-compose-image-discovery.sh
tests/test-custom-menu-agent-flags.sh
diff --git a/ods/tests/test_comfyui_extension_contract.py b/ods/tests/test_comfyui_extension_contract.py
new file mode 100644
index 000000000..29fb07874
--- /dev/null
+++ b/ods/tests/test_comfyui_extension_contract.py
@@ -0,0 +1,122 @@
+"""ComfyUI extension contracts that hold without Docker or a GPU.
+
+The NVIDIA image build is reproducible and fails loudly; Open WebUI's image
+settings are owner-settable with defaults that match what ODS ships; and the
+image model name agrees everywhere it is written down.
+"""
+import json
+import re
+from pathlib import Path
+
+import yaml
+
+ODS = Path(__file__).resolve().parents[1]
+COMFYUI = ODS / "extensions/services/comfyui"
+DOCKERFILE = (COMFYUI / "Dockerfile").read_text(encoding="utf-8")
+DOCKERFILE_CODE = "\n".join(line for line in DOCKERFILE.splitlines()
+ if not line.lstrip().startswith("#"))
+MODEL = "sdxl_lightning_4step.safetensors"
+
+# Open WebUI settings an owner may set in .env, with the shipped defaults.
+OPEN_WEBUI_IMAGE_DEFAULTS = {
+ "COMFYUI_BASE_URL": "http://comfyui:8188",
+ "IMAGE_GENERATION_MODEL": MODEL,
+ "IMAGE_SIZE": "1024x1024",
+ "IMAGE_STEPS": "4",
+}
+
+
+def _open_webui_environment():
+ base = yaml.safe_load((ODS / "docker-compose.base.yml").read_text(encoding="utf-8"))
+ return base["services"]["open-webui"]["environment"]
+
+
+def test_torch_pins_match_the_build_assertion():
+ installed = dict(re.findall(r"\b(torch|torchvision|torchaudio)==([0-9.]+)", DOCKERFILE_CODE))
+ asserted = dict(re.findall(r"(torch|torchvision|torchaudio)\.__version__ == '([0-9.]+)\+cu128'",
+ DOCKERFILE_CODE))
+ assert set(installed) == {"torch", "torchvision", "torchaudio"}, installed
+ assert installed == asserted
+ assert "--index-url https://download.pytorch.org/whl/cu128" in DOCKERFILE_CODE
+
+
+def test_build_steps_do_not_hide_failures():
+ assert "|| true" not in DOCKERFILE_CODE
+ assert "2>/dev/null" not in DOCKERFILE_CODE
+
+
+def test_every_pip_install_resolves_to_the_tested_set():
+ constraint = DOCKERFILE_CODE.index("ARG PIP_CONSTRAINT=/opt/ods-comfyui-constraints.txt")
+ assert DOCKERFILE_CODE.index("COPY constraints.txt /opt/ods-comfyui-constraints.txt") < constraint
+ assert constraint < DOCKERFILE_CODE.index("pip3 install")
+ pins = {}
+ for line in (COMFYUI / "constraints.txt").read_text(encoding="utf-8").splitlines():
+ if line and not line.startswith("#"):
+ name, separator, version = line.partition("==")
+ assert separator and name and version, line
+ pins[name.lower()] = version
+ installed = dict(re.findall(r"\b(torch|torchvision|torchaudio)==([0-9.]+)", DOCKERFILE_CODE))
+ for package, version in installed.items():
+ assert pins[package] == f"{version}+cu128", package
+ assert "comfy-kitchen" in pins
+
+
+def test_custom_nodes_are_pinned_and_manager_is_absent():
+ clones = re.findall(r"git clone (?:--branch \S+ --depth 1 )?https://github.com/([^/\s]+/[^\s.]+)",
+ DOCKERFILE_CODE)
+ assert "comfyanonymous/ComfyUI" in clones
+ nodes = [repo for repo in clones if repo != "comfyanonymous/ComfyUI"]
+ assert nodes == ["city96/ComfyUI-GGUF", "kijai/ComfyUI-KJNodes",
+ "Kosinkadink/ComfyUI-VideoHelperSuite", "Lightricks/ComfyUI-LTXVideo"]
+ assert len(re.findall(r"git checkout [0-9a-f]{7,40}\b", DOCKERFILE_CODE)) == len(nodes)
+ assert "ComfyUI-Manager" not in DOCKERFILE_CODE
+
+
+def test_build_imports_every_custom_node():
+ gate = re.search(r"python3 main\.py --cpu --quick-test-for-ci.*?rm -rf /tmp/ods-quick-test",
+ DOCKERFILE_CODE, re.S)
+ assert gate, "the import gate is missing"
+ step = gate.group(0)
+ assert "--database-url sqlite:///:memory:" in step
+ assert '! grep -E "IMPORT FAILED|PRESTARTUP FAILED|LTXV nodes could not be imported"' in step
+ assert 'test ! -e "$COMFYUI_DIR/user"' in step
+ # Built-in nodes list these when they load (nodes_audio.py reads input/),
+ # so each must exist before ComfyUI starts.
+ created = re.search(r"mkdir -p ((?:/tmp/ods-quick-test/\w+\s*\\?\s*)+)", DOCKERFILE_CODE)
+ assert created, "the scratch directories are not created"
+ for name in ("user", "output", "input", "temp"):
+ assert f"/tmp/ods-quick-test/{name}" in created.group(1), name
+ assert f"--{name}-directory /tmp/ods-quick-test/{name}" in step, name
+
+
+def test_open_webui_image_settings_are_owner_settable():
+ environment = _open_webui_environment()
+ schema = json.loads((ODS / ".env.schema.json").read_text(encoding="utf-8"))["properties"]
+ example = (ODS / ".env.example").read_text(encoding="utf-8")
+ for key, default in OPEN_WEBUI_IMAGE_DEFAULTS.items():
+ assert environment[key] == f"${{{key}:-{default}}}", key
+ assert str(schema[key]["default"]) == default, key
+ assert f"# {key}={default}\n" in example, key
+
+
+def test_image_model_name_agrees_everywhere():
+ environment = _open_webui_environment()
+ workflow = json.loads(environment["COMFYUI_WORKFLOW"])
+ loaders = [node for node in workflow.values() if node["class_type"] == "CheckpointLoaderSimple"]
+ assert [node["inputs"]["ckpt_name"] for node in loaders] == [MODEL]
+
+ installer = (ODS / "installers/phases/11-services.sh").read_text(encoding="utf-8")
+ assert f'SDXL_MODEL="{MODEL}"' in installer
+
+ n8n = (ODS / "extensions/library/workflows/comfyui/llm-to-image.json").read_text(encoding="utf-8")
+ assert f"$env.COMFYUI_MODEL_NAME || '{MODEL}'" in n8n
+ assert "flux1-dev" not in n8n
+
+
+def test_image_feature_metadata_is_truthful():
+ manifest = yaml.safe_load((COMFYUI / "manifest.yaml").read_text(encoding="utf-8"))
+ feature = next(item for item in manifest["features"] if item["id"] == "images")
+ assert "SDXL Lightning" in feature["description"]
+ assert "FLUX" not in feature["description"]
+ assert feature["requirements"]["vram_gb"] == 8
+ assert feature["setup_time"] != "Ready"
diff --git a/ods/tests/test_comfyui_image.py b/ods/tests/test_comfyui_image.py
new file mode 100644
index 000000000..444261f27
--- /dev/null
+++ b/ods/tests/test_comfyui_image.py
@@ -0,0 +1,56 @@
+"""Build the NVIDIA ComfyUI image and check what it ships (CI only).
+
+Set ODS_TEST_COMFYUI_IMAGE=1 to run it. It needs Docker and network access but
+no GPU: the Dockerfile's own build check already loaded every custom node on
+the CPU. ODS_TEST_COMFYUI_IIDFILE names where the built image id is written.
+"""
+import os
+import subprocess
+import tempfile
+import unittest
+from pathlib import Path
+
+CONTEXT = Path(__file__).resolve().parents[1] / "extensions/services/comfyui"
+NODES = ("ComfyUI-GGUF", "ComfyUI-KJNodes", "ComfyUI-LTXVideo", "ComfyUI-VideoHelperSuite")
+
+
[email protected](os.environ.get("ODS_TEST_COMFYUI_IMAGE") == "1",
+ "set ODS_TEST_COMFYUI_IMAGE=1 to build the ComfyUI image")
+class ComfyUIImageTests(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ iidfile = os.environ.get("ODS_TEST_COMFYUI_IIDFILE")
+ if not iidfile:
+ iidfile = str(Path(tempfile.mkdtemp(prefix="comfyui-image-")) / "image-id")
+ subprocess.run(["docker", "build", "--iidfile", iidfile,
+ "-f", str(CONTEXT / "Dockerfile"), str(CONTEXT)], check=True)
+ cls.image = Path(iidfile).read_text(encoding="utf-8").strip()
+
+ def python(self, code):
+ result = subprocess.run(
+ ["docker", "run", "--rm", "--network", "none", "--entrypoint", "python3", self.image, "-c", code],
+ check=True, capture_output=True, text=True)
+ return result.stdout.strip()
+
+ def test_pinned_torch_runs_without_a_gpu(self):
+ self.assertEqual(self.python("import torch; print(torch.__version__, torch.version.cuda)"),
+ "2.11.0+cu128 12.8")
+
+ def test_runs_as_the_unprivileged_comfyui_user(self):
+ result = subprocess.run(["docker", "image", "inspect", "--format", "{{.Config.User}}", self.image],
+ check=True, capture_output=True, text=True)
+ self.assertEqual(result.stdout.strip(), "comfyui")
+
+ def test_ships_the_pinned_nodes_and_no_manager(self):
+ installed = self.python("import os; print(' '.join(sorted(os.listdir('/opt/comfyui/custom_nodes'))))").split()
+ for node in NODES:
+ self.assertIn(node, installed)
+ self.assertNotIn("ComfyUI-Manager", installed)
+
+ def test_build_check_left_no_user_directory(self):
+ # startup.sh migrates an image-side user/ into the owner's mount.
+ self.assertEqual(self.python("import os; print(os.path.exists('/opt/comfyui/user'))"), "False")
+
+
+if __name__ == "__main__":
+ unittest.main()