From 26dc9c9e565700577f3cd7c67005fa40aaac3954 Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Wed, 2 Sep 2026 14:39:25 +0200 Subject: [PATCH 01/14] Update Dockerfile --- Dockerfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1dd71a95..17895add 100644 --- a/Dockerfile +++ b/Dockerfile @@ -179,8 +179,17 @@ RUN if [ "$MODEL_TYPE" = "z-image-turbo" ]; then \ wget -q --header="Authorization: Bearer ${HUGGINGFACE_ACCESS_TOKEN}" -O models/model_patches/Z-Image-Turbo-Fun-Controlnet-Union.safetensors https://huggingface.co/alibaba-pai/Z-Image-Turbo-Fun-Controlnet-Union/resolve/main/Z-Image-Turbo-Fun-Controlnet-Union.safetensors; \ fi +RUN if [ "$MODEL_TYPE" = "fluxed-up" ]; then \ + # Fluxed Up FP8 + wget -q -O models/checkpoints/fluxedUp.safetensors https://huggingface.co/HurdyThirty/FluxedUp/resolve/main/fluxedUpFluxNSFW_40DevFp8.safetensors && \ + # Required text encoders + VAE + wget -q -O models/clip/clip_l.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors && \ + wget -q -O models/clip/t5xxl_fp8_e4m3fn.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors && \ + wget -q -O models/vae/ae.safetensors https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.safetensors; \ + fi + # Stage 3: Final image FROM base AS final # Copy models from stage 2 to the final image -COPY --from=downloader /comfyui/models /comfyui/models \ No newline at end of file +COPY --from=downloader /comfyui/models /comfyui/models From 33e540b3a48829396d5d96400ef12a68ccdc2aee Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Wed, 2 Sep 2026 14:41:37 +0200 Subject: [PATCH 02/14] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 17895add..196cc2f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -135,7 +135,7 @@ FROM base AS downloader ARG HUGGINGFACE_ACCESS_TOKEN # Set default model type if none is provided -ARG MODEL_TYPE=flux1-dev-fp8 +ARG MODEL_TYPE=fluxed-up # Change working directory to ComfyUI WORKDIR /comfyui From 392acec0eed9558bc28fa170b60f6fdbee3bd24c Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Wed, 2 Sep 2026 15:02:37 +0200 Subject: [PATCH 03/14] Update Dockerfile --- Dockerfile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 196cc2f7..ce370d4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -180,12 +180,8 @@ RUN if [ "$MODEL_TYPE" = "z-image-turbo" ]; then \ fi RUN if [ "$MODEL_TYPE" = "fluxed-up" ]; then \ - # Fluxed Up FP8 - wget -q -O models/checkpoints/fluxedUp.safetensors https://huggingface.co/HurdyThirty/FluxedUp/resolve/main/fluxedUpFluxNSFW_40DevFp8.safetensors && \ - # Required text encoders + VAE - wget -q -O models/clip/clip_l.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors && \ - wget -q -O models/clip/t5xxl_fp8_e4m3fn.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors && \ - wget -q -O models/vae/ae.safetensors https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.safetensors; \ + wget -q -O models/checkpoints/fluxedUp.safetensors \ + "https://huggingface.co/HurdyThirty/FluxedUp/resolve/main/fluxedUpFluxNSFW_40DevFp8.safetensors"; \ fi # Stage 3: Final image From d7eb216dcfc31536036763eb3892848bc9f238ad Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Wed, 2 Sep 2026 17:14:21 +0200 Subject: [PATCH 04/14] Update tests.json --- .runpod/tests.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.runpod/tests.json b/.runpod/tests.json index 9a3769b9..e023d201 100644 --- a/.runpod/tests.json +++ b/.runpod/tests.json @@ -53,7 +53,7 @@ }, "30": { "inputs": { - "ckpt_name": "flux1-dev-fp8.safetensors" + "ckpt_name": "fluxedUp.safetensors" }, "class_type": "CheckpointLoaderSimple", "_meta": { From 567e8549234818d1575c03b1b46366d28ef32697 Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Wed, 2 Sep 2026 18:27:24 +0200 Subject: [PATCH 05/14] Update Dockerfile --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ce370d4b..b7ba4ae0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -180,8 +180,9 @@ RUN if [ "$MODEL_TYPE" = "z-image-turbo" ]; then \ fi RUN if [ "$MODEL_TYPE" = "fluxed-up" ]; then \ - wget -q -O models/checkpoints/fluxedUp.safetensors \ - "https://huggingface.co/HurdyThirty/FluxedUp/resolve/main/fluxedUpFluxNSFW_40DevFp8.safetensors"; \ + wget -O models/checkpoints/fluxedUp.safetensors "https://huggingface.co/HurdyThirty/FluxedUp/resolve/main/fluxedUpFluxNSFW_40DevFp8.safetensors" && \ + wget -O models/clip/clip_l.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors && \ + wget -O models/clip/t5xxl_fp8_e4m3fn.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors; \ fi # Stage 3: Final image From 75ca3aa5b4fa0ccd6f0c5bab8c895e5ae804964a Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Wed, 2 Sep 2026 18:29:09 +0200 Subject: [PATCH 06/14] Update tests.json --- .runpod/tests.json | 97 +++++++++++----------------------------------- 1 file changed, 22 insertions(+), 75 deletions(-) diff --git a/.runpod/tests.json b/.runpod/tests.json index e023d201..d0a1e410 100644 --- a/.runpod/tests.json +++ b/.runpod/tests.json @@ -3,62 +3,34 @@ { "name": "basic_test", "input": { - "images": [ - { - "name": "test.png", - "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAMklEQVR4nGI5ZdXAQEvARFPTRy0YtWDUglELRi0YtWDUglELRi0YtWDUAioCQAAAAP//E24Bx3jUKuYAAAAASUVORK5CYII=" - } - ], "workflow": { "6": { "inputs": { "text": "anime cat with massive fluffy fennec ears and a big fluffy tail blonde messy long hair blue eyes wearing a construction outfit placing a fancy black forest cake with candles on top of a dinner table of an old dark Victorian mansion lit by candlelight with a bright window to the foggy forest and very expensive stuff everywhere there are paintings on the walls", - "clip": ["30", 1] + "clip": ["60", 0] }, "class_type": "CLIPTextEncode", - "_meta": { - "title": "CLIP Text Encode (Positive Prompt)" - } + "_meta": { "title": "CLIP Text Encode (Positive Prompt)" } }, "8": { - "inputs": { - "samples": ["31", 0], - "vae": ["30", 2] - }, + "inputs": { "samples": ["31", 0], "vae": ["30", 2] }, "class_type": "VAEDecode", - "_meta": { - "title": "VAE Decode" - } + "_meta": { "title": "VAE Decode" } }, "9": { - "inputs": { - "filename_prefix": "ComfyUI", - "images": ["8", 0] - }, + "inputs": { "filename_prefix": "ComfyUI", "images": ["8", 0] }, "class_type": "SaveImage", - "_meta": { - "title": "Save Image" - } + "_meta": { "title": "Save Image" } }, "27": { - "inputs": { - "width": 512, - "height": 512, - "batch_size": 1 - }, + "inputs": { "width": 512, "height": 512, "batch_size": 1 }, "class_type": "EmptySD3LatentImage", - "_meta": { - "title": "EmptySD3LatentImage" - } + "_meta": { "title": "EmptySD3LatentImage" } }, "30": { - "inputs": { - "ckpt_name": "fluxedUp.safetensors" - }, + "inputs": { "ckpt_name": "fluxedUp.safetensors" }, "class_type": "CheckpointLoaderSimple", - "_meta": { - "title": "Load Checkpoint" - } + "_meta": { "title": "Load Checkpoint" } }, "31": { "inputs": { @@ -74,48 +46,26 @@ "latent_image": ["27", 0] }, "class_type": "KSampler", - "_meta": { - "title": "KSampler" - } + "_meta": { "title": "KSampler" } }, "33": { - "inputs": { - "text": "", - "clip": ["30", 1] - }, + "inputs": { "text": "", "clip": ["60", 0] }, "class_type": "CLIPTextEncode", - "_meta": { - "title": "CLIP Text Encode (Negative Prompt)" - } + "_meta": { "title": "CLIP Text Encode (Negative Prompt)" } }, "35": { - "inputs": { - "guidance": 3.5, - "conditioning": ["6", 0] - }, + "inputs": { "guidance": 3.5, "conditioning": ["6", 0] }, "class_type": "FluxGuidance", - "_meta": { - "title": "FluxGuidance" - } + "_meta": { "title": "FluxGuidance" } }, - "38": { + "60": { "inputs": { - "images": ["8", 0] + "clip_name1": "t5xxl_fp8_e4m3fn.safetensors", + "clip_name2": "clip_l.safetensors", + "type": "flux" }, - "class_type": "PreviewImage", - "_meta": { - "title": "Preview Image" - } - }, - "40": { - "inputs": { - "filename_prefix": "ComfyUI", - "images": ["8", 0] - }, - "class_type": "SaveImage", - "_meta": { - "title": "Save Image" - } + "class_type": "DualCLIPLoader", + "_meta": { "title": "DualCLIPLoader" } } } }, @@ -126,10 +76,7 @@ "gpuTypeId": "NVIDIA GeForce RTX 4090", "gpuCount": 1, "env": [ - { - "key": "REFRESH_WORKER", - "value": "false" - } + { "key": "REFRESH_WORKER", "value": "false" } ], "allowedCudaVersions": ["12.8", "12.9", "13.0"] } From 5e6d8b0bb27a338c66e657a16d787077cce19d57 Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Thu, 3 Sep 2026 04:38:56 +0200 Subject: [PATCH 07/14] Update Dockerfile --- Dockerfile | 107 ++++++++++++++++++++++------------------------------- 1 file changed, 44 insertions(+), 63 deletions(-) diff --git a/Dockerfile b/Dockerfile index b7ba4ae0..0a9bfd24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,28 +4,26 @@ ARG BASE_IMAGE=nvidia/cuda:12.8.1-cudnn-runtime-ubuntu24.04 # Stage 1: Base image with common dependencies FROM ${BASE_IMAGE} AS base -# Build arguments for this stage with sensible defaults for standalone builds ARG COMFYUI_VERSION=0.34.0 ARG CUDA_VERSION_FOR_COMFY=12.8 ARG ENABLE_PYTORCH_UPGRADE=false ARG PYTORCH_INDEX_URL -# Prevents prompts from packages asking for user input during installation ENV DEBIAN_FRONTEND=noninteractive -# Prefer binary wheels over source distributions for faster pip installations ENV PIP_PREFER_BINARY=1 -# Ensures output from python is printed immediately to the terminal without buffering ENV PYTHONUNBUFFERED=1 -# Speed up some cmake builds ENV CMAKE_BUILD_PARALLEL_LEVEL=8 -# Install Python, git and other necessary tools +# Install Python, C++ compilation toolchains (for insightface wheel compilation), and media dependencies RUN apt-get update && apt-get install -y \ + build-essential \ python3.12 \ - python3.12-venv \ + python3.12-dev \ git \ wget \ + unzip \ libgl1 \ + libgl1-mesa-glx \ libglib2.0-0 \ libsm6 \ libxext6 \ @@ -35,115 +33,98 @@ RUN apt-get update && apt-get install -y \ && ln -sf /usr/bin/python3.12 /usr/bin/python \ && ln -sf /usr/bin/pip3 /usr/bin/pip -# Clean up to reduce image size RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* -# Install uv (latest) using official installer and create isolated venv +# Install uv package manager and create target environment RUN wget -qO- https://astral.sh/uv/install.sh | sh \ && ln -s /root/.local/bin/uv /usr/local/bin/uv \ && ln -s /root/.local/bin/uvx /usr/local/bin/uvx \ && uv venv /opt/venv -# Use the virtual environment for all subsequent commands ENV PATH="/opt/venv/bin:${PATH}" -# Install comfy-cli + dependencies needed by it to install ComfyUI -# comfy-cli is pinned: its install/torch-index behavior decides what lands in -# the workspace venv, so an unpinned version makes builds non-reproducible. -RUN uv pip install comfy-cli==1.13.0 pip setuptools wheel +RUN uv pip install comfy-cli==1.13.0 pip setuptools wheel cython "numpy<2.0.0" -# Install ComfyUI +# Install ComfyUI Core RUN if [ -n "${CUDA_VERSION_FOR_COMFY}" ]; then \ /usr/bin/yes | comfy --workspace /comfyui install --version "${COMFYUI_VERSION}" --cuda-version "${CUDA_VERSION_FOR_COMFY}" --nvidia; \ else \ /usr/bin/yes | comfy --workspace /comfyui install --version "${COMFYUI_VERSION}" --nvidia; \ fi -# Upgrade PyTorch if needed (for newer CUDA versions) +# Clone the PuLID Flux Custom Node Extension +RUN git clone https://github.com/lldacing/ComfyUI_PuLID_Flux_ll.git /comfyui/custom_nodes/ComfyUI_PuLID_Flux_ll + +# Upgrade PyTorch if needed RUN if [ "$ENABLE_PYTORCH_UPGRADE" = "true" ]; then \ uv pip install --force-reinstall torch torchvision torchaudio --index-url ${PYTORCH_INDEX_URL}; \ fi -# comfy-cli installs ComfyUI into its own workspace venv (/comfyui/.venv), but -# start.sh launches ComfyUI with /opt/venv's python. That mismatch leaves the -# launch venv missing ComfyUI's runtime deps (e.g. sqlalchemy, pulled in by -# ComfyUI's asset DB), so ComfyUI crashes at startup and surfaces as the -# misleading "ComfyUI server (127.0.0.1:8188) not reachable" error. Mirror -# ComfyUI's full dependency set (core + custom nodes) into /opt/venv so the -# launch venv is complete. Root-cause fix for DR-1170. -# -# The transformers/huggingface-hub pin is part of the SAME step on purpose: -# ComfyUI declares transformers>=4.50.3 and huggingface-hub with NO upper bound, -# so a fresh install can pull transformers 5.x / huggingface-hub 1.x whose -# breaking API changes also crash ComfyUI at startup. Pinning them in the same -# RUN downgrades within one layer, so the unwanted versions aren't left behind -# bloating the image. -# -# torch is installed FIRST, pinned to +cu128 builds: ComfyUI's requirements.txt -# declares a bare `torch`, and default PyPI serves CUDA 13 builds (torch's PyPI -# wheels depend on nvidia-*-cu13 since 2.11) that require driver >= 580. Hosts -# allowed in .runpod/hub.json advertise CUDA 12.8/12.9 (driver 570/575), where -# a cu13 torch fails CUDA init at startup. cu128 builds run on driver >= 570, -# i.e. every allowed host. Installing torch first satisfies the bare `torch` -# requirement so the PyPI pass doesn't touch it. +# Install PyTorch cu128 and all node dependencies (including insightface & facenet-pytorch) RUN uv pip install torch==2.11.0 torchvision==0.26.0 torchaudio==2.11.0 \ --index-url https://download.pytorch.org/whl/cu128 \ && uv pip install -r /comfyui/requirements.txt \ && for r in /comfyui/custom_nodes/*/requirements.txt; do \ [ -f "$r" ] && uv pip install -r "$r" || true; \ done \ + && uv pip install "numpy<2.0.0" onnxruntime-gpu insightface open-clip-torch \ + && uv pip install facenet-pytorch --no-deps \ && uv pip install "transformers>=4.50.3,<5" "huggingface-hub<1.0" -# Build-time smoke test: actually start ComfyUI (imports the full node graph) so -# a startup-breaking dependency is caught HERE, at build time, instead of as a -# runtime "server not reachable" failure on a live worker. Runs on CPU — no GPU -# needed to exercise the import graph. +# Build-time import check: Validates that PulidFluxModelLoader and node #70 import properly on CPU RUN cd /comfyui && timeout 300 python main.py --quick-test-for-ci --cpu -# Change working directory to ComfyUI WORKDIR /comfyui - -# Support for the network volume ADD src/extra_model_paths.yaml ./ - -# Go back to the root WORKDIR / -# Install Python runtime dependencies for the handler RUN uv pip install runpod requests websocket-client - -# Add application code and scripts ADD src/start.sh src/network_volume.py handler.py test_input.json ./ RUN chmod +x /start.sh -# Add script to install custom nodes COPY scripts/comfy-node-install.sh /usr/local/bin/comfy-node-install RUN chmod +x /usr/local/bin/comfy-node-install -# Prevent pip from asking for confirmation during uninstall steps in custom nodes ENV PIP_NO_INPUT=1 -# Copy helper script to switch Manager network mode at container start COPY scripts/comfy-manager-set-mode.sh /usr/local/bin/comfy-manager-set-mode RUN chmod +x /usr/local/bin/comfy-manager-set-mode -# Set the default command to run when starting the container CMD ["/start.sh"] -# Stage 2: Download models +# Stage 2: Pre-fetch all Flux & PuLID model dependencies FROM base AS downloader ARG HUGGINGFACE_ACCESS_TOKEN -# Set default model type if none is provided ARG MODEL_TYPE=fluxed-up -# Change working directory to ComfyUI WORKDIR /comfyui -# Create necessary directories upfront -RUN mkdir -p models/checkpoints models/vae models/unet models/clip models/text_encoders models/diffusion_models models/model_patches - -# Download checkpoints/vae/unet/clip models to include in image based on model type +# Create explicit model directory structures +RUN mkdir -p models/checkpoints \ + models/vae \ + models/unet \ + models/clip \ + models/text_encoders \ + models/diffusion_models \ + models/model_patches \ + models/pulid \ + models/insightface/models/antelopev2 + +# 1. Download PuLID Flux Adapter Weights +RUN wget -q -O models/pulid/PuLID-FLUX-v0.9.1.safetensors \ + https://huggingface.co/guozinan/PuLID/resolve/main/PuLID-FLUX-v0.9.1.safetensors + +# 2. Download EVA-CLIP Model Weight for PuLID +RUN wget -q -O models/clip/EVA02_CLIP_L_336_psz14_s6B.pt \ + https://huggingface.co/QuanSun/EVA-CLIP/resolve/main/EVA02_CLIP_L_336_psz14_s6B.pt + +# 3. Download and Extract InsightFace antelopev2 Models +RUN wget -q -O /tmp/antelopev2.zip https://huggingface.co/MONA-LISA/antelopev2/resolve/main/antelopev2.zip \ + && unzip /tmp/antelopev2.zip -d models/insightface/models/antelopev2 \ + && rm /tmp/antelopev2.zip + +# Conditional model downloads RUN if [ "$MODEL_TYPE" = "sdxl" ]; then \ wget -q -O models/checkpoints/sd_xl_base_1.0.safetensors https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors && \ wget -q -O models/vae/sdxl_vae.safetensors https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors && \ @@ -185,8 +166,8 @@ RUN if [ "$MODEL_TYPE" = "fluxed-up" ]; then \ wget -O models/clip/t5xxl_fp8_e4m3fn.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors; \ fi -# Stage 3: Final image +# Stage 3: Final image assembly FROM base AS final -# Copy models from stage 2 to the final image +# Transfer full model directory into final container stage COPY --from=downloader /comfyui/models /comfyui/models From 86a29e3641df32ec676424762cc191ade19cca76 Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Thu, 3 Sep 2026 04:51:44 +0200 Subject: [PATCH 08/14] Update Dockerfile --- Dockerfile | 61 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0a9bfd24..8a4e29a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ # Build argument for base image selection ARG BASE_IMAGE=nvidia/cuda:12.8.1-cudnn-runtime-ubuntu24.04 -# Stage 1: Base image with common dependencies +# ============================================================================== +# Stage 1: Base Environment & Dependency Setup +# ============================================================================== FROM ${BASE_IMAGE} AS base ARG COMFYUI_VERSION=0.34.0 @@ -14,7 +16,7 @@ ENV PIP_PREFER_BINARY=1 ENV PYTHONUNBUFFERED=1 ENV CMAKE_BUILD_PARALLEL_LEVEL=8 -# Install Python, C++ compilation toolchains (for insightface wheel compilation), and media dependencies +# Install Python 3.12, C++ compilation tools (for insightface wheel compilation), and media libs RUN apt-get update && apt-get install -y \ build-essential \ python3.12 \ @@ -31,11 +33,10 @@ RUN apt-get update && apt-get install -y \ ffmpeg \ openssh-server \ && ln -sf /usr/bin/python3.12 /usr/bin/python \ - && ln -sf /usr/bin/pip3 /usr/bin/pip + && ln -sf /usr/bin/pip3 /usr/bin/pip \ + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* -RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* - -# Install uv package manager and create target environment +# Install uv package manager and create virtual environment RUN wget -qO- https://astral.sh/uv/install.sh | sh \ && ln -s /root/.local/bin/uv /usr/local/bin/uv \ && ln -s /root/.local/bin/uvx /usr/local/bin/uvx \ @@ -55,30 +56,27 @@ RUN if [ -n "${CUDA_VERSION_FOR_COMFY}" ]; then \ # Clone the PuLID Flux Custom Node Extension RUN git clone https://github.com/lldacing/ComfyUI_PuLID_Flux_ll.git /comfyui/custom_nodes/ComfyUI_PuLID_Flux_ll -# Upgrade PyTorch if needed +# Upgrade PyTorch if requested RUN if [ "$ENABLE_PYTORCH_UPGRADE" = "true" ]; then \ uv pip install --force-reinstall torch torchvision torchaudio --index-url ${PYTORCH_INDEX_URL}; \ fi -# Install PyTorch cu128 and all node dependencies (including insightface & facenet-pytorch) +# Install PyTorch cu128 and node requirements (including insightface, facenet-pytorch, and facexlib) RUN uv pip install torch==2.11.0 torchvision==0.26.0 torchaudio==2.11.0 \ --index-url https://download.pytorch.org/whl/cu128 \ && uv pip install -r /comfyui/requirements.txt \ && for r in /comfyui/custom_nodes/*/requirements.txt; do \ [ -f "$r" ] && uv pip install -r "$r" || true; \ done \ - && uv pip install "numpy<2.0.0" onnxruntime-gpu insightface open-clip-torch \ + && uv pip install "numpy<2.0.0" onnxruntime-gpu insightface open-clip-torch facexlib \ && uv pip install facenet-pytorch --no-deps \ - && uv pip install "transformers>=4.50.3,<5" "huggingface-hub<1.0" - -# Build-time import check: Validates that PulidFluxModelLoader and node #70 import properly on CPU -RUN cd /comfyui && timeout 300 python main.py --quick-test-for-ci --cpu + && uv pip install "transformers>=4.50.3,<5" "huggingface-hub<1.0" \ + && uv pip install runpod requests websocket-client WORKDIR /comfyui ADD src/extra_model_paths.yaml ./ WORKDIR / -RUN uv pip install runpod requests websocket-client ADD src/start.sh src/network_volume.py handler.py test_input.json ./ RUN chmod +x /start.sh @@ -90,9 +88,9 @@ ENV PIP_NO_INPUT=1 COPY scripts/comfy-manager-set-mode.sh /usr/local/bin/comfy-manager-set-mode RUN chmod +x /usr/local/bin/comfy-manager-set-mode -CMD ["/start.sh"] - -# Stage 2: Pre-fetch all Flux & PuLID model dependencies +# ============================================================================== +# Stage 2: Pre-fetch Models and Weights (Avoid Cold Start Latency) +# ============================================================================== FROM base AS downloader ARG HUGGINGFACE_ACCESS_TOKEN @@ -100,7 +98,7 @@ ARG MODEL_TYPE=fluxed-up WORKDIR /comfyui -# Create explicit model directory structures +# Create model directory structure RUN mkdir -p models/checkpoints \ models/vae \ models/unet \ @@ -109,7 +107,9 @@ RUN mkdir -p models/checkpoints \ models/diffusion_models \ models/model_patches \ models/pulid \ - models/insightface/models/antelopev2 + models/insightface/models/antelopev2 \ + models/facexlib \ + /root/.cache/facexlib/weights/ # 1. Download PuLID Flux Adapter Weights RUN wget -q -O models/pulid/PuLID-FLUX-v0.9.1.safetensors \ @@ -124,7 +124,12 @@ RUN wget -q -O /tmp/antelopev2.zip https://huggingface.co/MONA-LISA/antelopev2/r && unzip /tmp/antelopev2.zip -d models/insightface/models/antelopev2 \ && rm /tmp/antelopev2.zip -# Conditional model downloads +# 4. Download facexlib detection weights (prevents runtime download timeouts) +RUN wget -q -O /root/.cache/facexlib/weights/detection_Resnet50_Final.pth \ + https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth \ + && cp /root/.cache/facexlib/weights/detection_Resnet50_Final.pth models/facexlib/ + +# Conditional model downloads based on MODEL_TYPE RUN if [ "$MODEL_TYPE" = "sdxl" ]; then \ wget -q -O models/checkpoints/sd_xl_base_1.0.safetensors https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors && \ wget -q -O models/vae/sdxl_vae.safetensors https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors && \ @@ -166,8 +171,20 @@ RUN if [ "$MODEL_TYPE" = "fluxed-up" ]; then \ wget -O models/clip/t5xxl_fp8_e4m3fn.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors; \ fi -# Stage 3: Final image assembly +# ============================================================================== +# Stage 3: Final Image Assembly and Import Verification +# ============================================================================== FROM base AS final -# Transfer full model directory into final container stage +# Transfer full model cache from Stage 2 COPY --from=downloader /comfyui/models /comfyui/models +COPY --from=downloader /root/.cache /root/.cache + +# Symlink InsightFace home folder so runtime lookup passes +RUN mkdir -p /root/.insightface \ + && ln -s /comfyui/models/insightface/models /root/.insightface/models + +# Build-time import check: Runs AFTER models & custom nodes are mounted +RUN cd /comfyui && timeout 300 python main.py --quick-test-for-ci --cpu + +CMD ["/start.sh"] From 26cf327a2d5b5e696eb6fa8621ef8d5b4fe12435 Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Thu, 3 Sep 2026 14:02:14 +0200 Subject: [PATCH 09/14] Update handler.py --- handler.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/handler.py b/handler.py index 817cad8a..83fe1d6d 100644 --- a/handler.py +++ b/handler.py @@ -13,7 +13,7 @@ import tempfile import socket import traceback -import logging +import builtins from network_volume import ( is_network_volume_debug_enabled, @@ -22,9 +22,20 @@ # --------------------------------------------------------------------------- # Logging setup +# +# Shadow the builtin print() so every print in this module is gated behind +# WORKER_VERBOSE, without having to touch ~60 individual call sites. Python +# resolves names in module globals before builtins, so all prints below -- +# including multi-line ones -- route through this function. Set +# WORKER_VERBOSE=true on the endpoint to get the detail back; no rebuild needed. # --------------------------------------------------------------------------- -logging.basicConfig(level=logging.INFO) -logger = logging.getLogger(__name__) +VERBOSE = os.environ.get("WORKER_VERBOSE", "false").lower() == "true" + + +def print(*args, **kwargs): + if VERBOSE: + builtins.print(*args, **kwargs) + # Time to wait between API check attempts in milliseconds COMFY_API_AVAILABLE_INTERVAL_MS = int( @@ -438,10 +449,13 @@ def queue_workflow(workflow, client_id, comfy_org_api_key=None): # Handle validation errors with detailed information if response.status_code == 400: - print(f"worker-comfyui - ComfyUI returned 400. Response body: {response.text}") + # NOTE: do NOT log response.text -- ComfyUI's 400 body echoes the + # submitted graph back, prompt text included. The detail still reaches + # the caller via the ValueError raised below, which travels in the job + # response rather than the console log stream. + print(f"worker-comfyui - ComfyUI returned 400 ({len(response.text)} bytes)") try: error_data = response.json() - print(f"worker-comfyui - Parsed error data: {error_data}") # Try to extract meaningful error information error_message = "Workflow validation failed" From c69cdd2a408cca4812de5c1c8f9460b032e3296b Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Thu, 3 Sep 2026 14:11:25 +0200 Subject: [PATCH 10/14] Update Dockerfile --- Dockerfile | 153 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 103 insertions(+), 50 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8a4e29a9..77ca0d47 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,31 +1,36 @@ # Build argument for base image selection ARG BASE_IMAGE=nvidia/cuda:12.8.1-cudnn-runtime-ubuntu24.04 -# ============================================================================== -# Stage 1: Base Environment & Dependency Setup -# ============================================================================== +# Stage 1: Base image with common dependencies FROM ${BASE_IMAGE} AS base +# Build arguments for this stage with sensible defaults for standalone builds ARG COMFYUI_VERSION=0.34.0 ARG CUDA_VERSION_FOR_COMFY=12.8 ARG ENABLE_PYTORCH_UPGRADE=false ARG PYTORCH_INDEX_URL +# Prevents prompts from packages asking for user input during installation ENV DEBIAN_FRONTEND=noninteractive +# Prefer binary wheels over source distributions for faster pip installations ENV PIP_PREFER_BINARY=1 +# Ensures output from python is printed immediately to the terminal without buffering ENV PYTHONUNBUFFERED=1 +# Speed up some cmake builds ENV CMAKE_BUILD_PARALLEL_LEVEL=8 -# Install Python 3.12, C++ compilation tools (for insightface wheel compilation), and media libs +# Install Python, git and other necessary tools +# PULID: build-essential + python3.12-dev are required because insightface has no +# cp312 wheel and compiles from source. unzip is for the antelopev2 archive. RUN apt-get update && apt-get install -y \ - build-essential \ python3.12 \ + python3.12-venv \ python3.12-dev \ + build-essential \ git \ wget \ unzip \ libgl1 \ - libgl1-mesa-glx \ libglib2.0-0 \ libsm6 \ libxext6 \ @@ -33,103 +38,155 @@ RUN apt-get update && apt-get install -y \ ffmpeg \ openssh-server \ && ln -sf /usr/bin/python3.12 /usr/bin/python \ - && ln -sf /usr/bin/pip3 /usr/bin/pip \ - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* + && ln -sf /usr/bin/pip3 /usr/bin/pip -# Install uv package manager and create virtual environment +# Clean up to reduce image size +RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* + +# Install uv (latest) using official installer and create isolated venv RUN wget -qO- https://astral.sh/uv/install.sh | sh \ && ln -s /root/.local/bin/uv /usr/local/bin/uv \ && ln -s /root/.local/bin/uvx /usr/local/bin/uvx \ && uv venv /opt/venv +# Use the virtual environment for all subsequent commands ENV PATH="/opt/venv/bin:${PATH}" +# Install comfy-cli + dependencies needed by it to install ComfyUI +# comfy-cli is pinned: its install/torch-index behavior decides what lands in +# the workspace venv, so an unpinned version makes builds non-reproducible. +# PULID: cython and numpy must be present in THIS venv before insightface is +# installed below with --no-build-isolation. RUN uv pip install comfy-cli==1.13.0 pip setuptools wheel cython "numpy<2.0.0" -# Install ComfyUI Core +# Install ComfyUI RUN if [ -n "${CUDA_VERSION_FOR_COMFY}" ]; then \ /usr/bin/yes | comfy --workspace /comfyui install --version "${COMFYUI_VERSION}" --cuda-version "${CUDA_VERSION_FOR_COMFY}" --nvidia; \ else \ /usr/bin/yes | comfy --workspace /comfyui install --version "${COMFYUI_VERSION}" --nvidia; \ fi -# Clone the PuLID Flux Custom Node Extension -RUN git clone https://github.com/lldacing/ComfyUI_PuLID_Flux_ll.git /comfyui/custom_nodes/ComfyUI_PuLID_Flux_ll +# PULID: clone the custom node BEFORE the dependency step below, so the +# custom_nodes/*/requirements.txt loop picks up its requirements too. +RUN git clone https://github.com/lldacing/ComfyUI_PuLID_Flux_ll.git \ + /comfyui/custom_nodes/ComfyUI_PuLID_Flux_ll -# Upgrade PyTorch if requested +# Upgrade PyTorch if needed (for newer CUDA versions) RUN if [ "$ENABLE_PYTORCH_UPGRADE" = "true" ]; then \ uv pip install --force-reinstall torch torchvision torchaudio --index-url ${PYTORCH_INDEX_URL}; \ fi -# Install PyTorch cu128 and node requirements (including insightface, facenet-pytorch, and facexlib) +# comfy-cli installs ComfyUI into its own workspace venv (/comfyui/.venv), but +# start.sh launches ComfyUI with /opt/venv's python. That mismatch leaves the +# launch venv missing ComfyUI's runtime deps (e.g. sqlalchemy, pulled in by +# ComfyUI's asset DB), so ComfyUI crashes at startup and surfaces as the +# misleading "ComfyUI server (127.0.0.1:8188) not reachable" error. Mirror +# ComfyUI's full dependency set (core + custom nodes) into /opt/venv so the +# launch venv is complete. Root-cause fix for DR-1170. +# +# The transformers/huggingface-hub pin is part of the SAME step on purpose: +# ComfyUI declares transformers>=4.50.3 and huggingface-hub with NO upper bound, +# so a fresh install can pull transformers 5.x / huggingface-hub 1.x whose +# breaking API changes also crash ComfyUI at startup. Pinning them in the same +# RUN downgrades within one layer, so the unwanted versions aren't left behind +# bloating the image. +# +# torch is installed FIRST, pinned to +cu128 builds: ComfyUI's requirements.txt +# declares a bare `torch`, and default PyPI serves CUDA 13 builds (torch's PyPI +# wheels depend on nvidia-*-cu13 since 2.11) that require driver >= 580. Hosts +# allowed in .runpod/hub.json advertise CUDA 12.8/12.9 (driver 570/575), where +# a cu13 torch fails CUDA init at startup. cu128 builds run on driver >= 570, +# i.e. every allowed host. Installing torch first satisfies the bare `torch` +# requirement so the PyPI pass doesn't touch it. +# +# PULID: insightface uses --no-build-isolation because its setup.py imports +# numpy and cython at build time, which uv's isolated build env doesn't provide. +# facenet-pytorch uses --no-deps because its pins would drag in an older torch. +# numpy is re-pinned in the SAME step, after the requirements passes, so nothing +# upstream can leave numpy 2.x as the final state (insightface/onnxruntime need 1.x). RUN uv pip install torch==2.11.0 torchvision==0.26.0 torchaudio==2.11.0 \ --index-url https://download.pytorch.org/whl/cu128 \ && uv pip install -r /comfyui/requirements.txt \ && for r in /comfyui/custom_nodes/*/requirements.txt; do \ [ -f "$r" ] && uv pip install -r "$r" || true; \ done \ - && uv pip install "numpy<2.0.0" onnxruntime-gpu insightface open-clip-torch facexlib \ + && uv pip install onnxruntime-gpu open-clip-torch facexlib \ + && uv pip install insightface --no-build-isolation \ && uv pip install facenet-pytorch --no-deps \ - && uv pip install "transformers>=4.50.3,<5" "huggingface-hub<1.0" \ - && uv pip install runpod requests websocket-client + && uv pip install "transformers>=4.50.3,<5" "huggingface-hub<1.0" "numpy<2.0.0" + +# Build-time smoke test: actually start ComfyUI (imports the full node graph) so +# a startup-breaking dependency is caught HERE, at build time, instead of as a +# runtime "server not reachable" failure on a live worker. Runs on CPU — no GPU +# needed to exercise the import graph. +RUN cd /comfyui && timeout 300 python main.py --quick-test-for-ci --cpu +# Change working directory to ComfyUI WORKDIR /comfyui + +# Support for the network volume ADD src/extra_model_paths.yaml ./ + +# Go back to the root WORKDIR / +# Install Python runtime dependencies for the handler +RUN uv pip install runpod requests websocket-client + +# Add application code and scripts ADD src/start.sh src/network_volume.py handler.py test_input.json ./ RUN chmod +x /start.sh +# Add script to install custom nodes COPY scripts/comfy-node-install.sh /usr/local/bin/comfy-node-install RUN chmod +x /usr/local/bin/comfy-node-install +# Prevent pip from asking for confirmation during uninstall steps in custom nodes ENV PIP_NO_INPUT=1 +# Copy helper script to switch Manager network mode at container start COPY scripts/comfy-manager-set-mode.sh /usr/local/bin/comfy-manager-set-mode RUN chmod +x /usr/local/bin/comfy-manager-set-mode -# ============================================================================== -# Stage 2: Pre-fetch Models and Weights (Avoid Cold Start Latency) -# ============================================================================== +# Set the default command to run when starting the container +CMD ["/start.sh"] + +# Stage 2: Download models FROM base AS downloader ARG HUGGINGFACE_ACCESS_TOKEN +# Set default model type if none is provided ARG MODEL_TYPE=fluxed-up +# Change working directory to ComfyUI WORKDIR /comfyui -# Create model directory structure -RUN mkdir -p models/checkpoints \ - models/vae \ - models/unet \ - models/clip \ - models/text_encoders \ - models/diffusion_models \ - models/model_patches \ +# Create necessary directories upfront +# PULID: pulid, insightface, facexlib dirs added +RUN mkdir -p models/checkpoints models/vae models/unet models/clip models/text_encoders models/diffusion_models models/model_patches \ models/pulid \ models/insightface/models/antelopev2 \ models/facexlib \ - /root/.cache/facexlib/weights/ + /root/.cache/facexlib/weights -# 1. Download PuLID Flux Adapter Weights +# PULID: adapter weights, EVA-CLIP, antelopev2 face models, facexlib detector. +# These are unconditional — they're needed regardless of MODEL_TYPE. RUN wget -q -O models/pulid/PuLID-FLUX-v0.9.1.safetensors \ - https://huggingface.co/guozinan/PuLID/resolve/main/PuLID-FLUX-v0.9.1.safetensors + https://huggingface.co/guozinan/PuLID/resolve/main/PuLID-FLUX-v0.9.1.safetensors -# 2. Download EVA-CLIP Model Weight for PuLID RUN wget -q -O models/clip/EVA02_CLIP_L_336_psz14_s6B.pt \ - https://huggingface.co/QuanSun/EVA-CLIP/resolve/main/EVA02_CLIP_L_336_psz14_s6B.pt + https://huggingface.co/QuanSun/EVA-CLIP/resolve/main/EVA02_CLIP_L_336_psz14_s6B.pt -# 3. Download and Extract InsightFace antelopev2 Models -RUN wget -q -O /tmp/antelopev2.zip https://huggingface.co/MONA-LISA/antelopev2/resolve/main/antelopev2.zip \ - && unzip /tmp/antelopev2.zip -d models/insightface/models/antelopev2 \ +RUN wget -q -O /tmp/antelopev2.zip \ + https://huggingface.co/MONA-LISA/antelopev2/resolve/main/antelopev2.zip \ + && unzip -q /tmp/antelopev2.zip -d models/insightface/models/antelopev2 \ && rm /tmp/antelopev2.zip -# 4. Download facexlib detection weights (prevents runtime download timeouts) RUN wget -q -O /root/.cache/facexlib/weights/detection_Resnet50_Final.pth \ - https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth \ + https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth \ && cp /root/.cache/facexlib/weights/detection_Resnet50_Final.pth models/facexlib/ -# Conditional model downloads based on MODEL_TYPE +# Download checkpoints/vae/unet/clip models to include in image based on model type RUN if [ "$MODEL_TYPE" = "sdxl" ]; then \ wget -q -O models/checkpoints/sd_xl_base_1.0.safetensors https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors && \ wget -q -O models/vae/sdxl_vae.safetensors https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors && \ @@ -171,20 +228,16 @@ RUN if [ "$MODEL_TYPE" = "fluxed-up" ]; then \ wget -O models/clip/t5xxl_fp8_e4m3fn.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors; \ fi -# ============================================================================== -# Stage 3: Final Image Assembly and Import Verification -# ============================================================================== +# Stage 3: Final image FROM base AS final -# Transfer full model cache from Stage 2 +# Copy models from stage 2 to the final image COPY --from=downloader /comfyui/models /comfyui/models -COPY --from=downloader /root/.cache /root/.cache -# Symlink InsightFace home folder so runtime lookup passes +# PULID: facexlib looks in ~/.cache at runtime; copy only that subdirectory, not +# all of /root/.cache, which also holds uv's multi-GB wheel cache. +COPY --from=downloader /root/.cache/facexlib /root/.cache/facexlib + +# PULID: insightface resolves models from ~/.insightface/models at runtime RUN mkdir -p /root/.insightface \ && ln -s /comfyui/models/insightface/models /root/.insightface/models - -# Build-time import check: Runs AFTER models & custom nodes are mounted -RUN cd /comfyui && timeout 300 python main.py --quick-test-for-ci --cpu - -CMD ["/start.sh"] From 594cd8b15c36ba0b0f4d9b64403959aae8b1f1c1 Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Thu, 3 Sep 2026 15:03:52 +0200 Subject: [PATCH 11/14] Update handler.py --- handler.py | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/handler.py b/handler.py index 83fe1d6d..883c75f2 100644 --- a/handler.py +++ b/handler.py @@ -13,29 +13,26 @@ import tempfile import socket import traceback -import builtins +import logging from network_volume import ( is_network_volume_debug_enabled, run_network_volume_diagnostics, ) -# --------------------------------------------------------------------------- -# Logging setup -# -# Shadow the builtin print() so every print in this module is gated behind -# WORKER_VERBOSE, without having to touch ~60 individual call sites. Python -# resolves names in module globals before builtins, so all prints below -- -# including multi-line ones -- route through this function. Set -# WORKER_VERBOSE=true on the endpoint to get the detail back; no rebuild needed. -# --------------------------------------------------------------------------- -VERBOSE = os.environ.get("WORKER_VERBOSE", "false").lower() == "true" +import builtins +VERBOSE = os.environ.get("WORKER_VERBOSE", "false").lower() == "true" def print(*args, **kwargs): if VERBOSE: builtins.print(*args, **kwargs) +# --------------------------------------------------------------------------- +# Logging setup +# --------------------------------------------------------------------------- +logging.basicConfig(level=logging.INFO) +logger = logging.getLogger(__name__) # Time to wait between API check attempts in milliseconds COMFY_API_AVAILABLE_INTERVAL_MS = int( @@ -449,10 +446,6 @@ def queue_workflow(workflow, client_id, comfy_org_api_key=None): # Handle validation errors with detailed information if response.status_code == 400: - # NOTE: do NOT log response.text -- ComfyUI's 400 body echoes the - # submitted graph back, prompt text included. The detail still reaches - # the caller via the ValueError raised below, which travels in the job - # response rather than the console log stream. print(f"worker-comfyui - ComfyUI returned 400 ({len(response.text)} bytes)") try: error_data = response.json() From aa3345eb487a06b822a5f3fe37da4f1c22d6b517 Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Thu, 3 Sep 2026 15:33:45 +0200 Subject: [PATCH 12/14] Update Dockerfile --- Dockerfile | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index 77ca0d47..1c41550b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,8 +20,6 @@ ENV PYTHONUNBUFFERED=1 ENV CMAKE_BUILD_PARALLEL_LEVEL=8 # Install Python, git and other necessary tools -# PULID: build-essential + python3.12-dev are required because insightface has no -# cp312 wheel and compiles from source. unzip is for the antelopev2 archive. RUN apt-get update && apt-get install -y \ python3.12 \ python3.12-venv \ @@ -55,7 +53,7 @@ ENV PATH="/opt/venv/bin:${PATH}" # Install comfy-cli + dependencies needed by it to install ComfyUI # comfy-cli is pinned: its install/torch-index behavior decides what lands in # the workspace venv, so an unpinned version makes builds non-reproducible. -# PULID: cython and numpy must be present in THIS venv before insightface is +# PULID: cython and numpy must exist in THIS venv before insightface is # installed below with --no-build-isolation. RUN uv pip install comfy-cli==1.13.0 pip setuptools wheel cython "numpy<2.0.0" @@ -66,8 +64,8 @@ RUN if [ -n "${CUDA_VERSION_FOR_COMFY}" ]; then \ /usr/bin/yes | comfy --workspace /comfyui install --version "${COMFYUI_VERSION}" --nvidia; \ fi -# PULID: clone the custom node BEFORE the dependency step below, so the -# custom_nodes/*/requirements.txt loop picks up its requirements too. +# PULID: clone before the dependency step so the custom_nodes/*/requirements.txt +# loop below picks up its requirements too. RUN git clone https://github.com/lldacing/ComfyUI_PuLID_Flux_ll.git \ /comfyui/custom_nodes/ComfyUI_PuLID_Flux_ll @@ -98,12 +96,6 @@ RUN if [ "$ENABLE_PYTORCH_UPGRADE" = "true" ]; then \ # a cu13 torch fails CUDA init at startup. cu128 builds run on driver >= 570, # i.e. every allowed host. Installing torch first satisfies the bare `torch` # requirement so the PyPI pass doesn't touch it. -# -# PULID: insightface uses --no-build-isolation because its setup.py imports -# numpy and cython at build time, which uv's isolated build env doesn't provide. -# facenet-pytorch uses --no-deps because its pins would drag in an older torch. -# numpy is re-pinned in the SAME step, after the requirements passes, so nothing -# upstream can leave numpy 2.x as the final state (insightface/onnxruntime need 1.x). RUN uv pip install torch==2.11.0 torchvision==0.26.0 torchaudio==2.11.0 \ --index-url https://download.pytorch.org/whl/cu128 \ && uv pip install -r /comfyui/requirements.txt \ @@ -162,15 +154,15 @@ ARG MODEL_TYPE=fluxed-up WORKDIR /comfyui # Create necessary directories upfront -# PULID: pulid, insightface, facexlib dirs added RUN mkdir -p models/checkpoints models/vae models/unet models/clip models/text_encoders models/diffusion_models models/model_patches \ models/pulid \ - models/insightface/models/antelopev2 \ - models/facexlib \ - /root/.cache/facexlib/weights + models/insightface/models/antelopev2 -# PULID: adapter weights, EVA-CLIP, antelopev2 face models, facexlib detector. -# These are unconditional — they're needed regardless of MODEL_TYPE. +# PULID: adapter weights, EVA-CLIP, antelopev2. Unconditional — needed for any +# MODEL_TYPE. NOTE: nothing here writes to /root/.cache. RunPod's builder owns +# that path (see the "Creating cache directory" build step) and a Dockerfile +# that writes into it or COPY --from=s out of it fails the build before any +# instruction runs. facexlib fetches its detector at first use instead. RUN wget -q -O models/pulid/PuLID-FLUX-v0.9.1.safetensors \ https://huggingface.co/guozinan/PuLID/resolve/main/PuLID-FLUX-v0.9.1.safetensors @@ -182,10 +174,6 @@ RUN wget -q -O /tmp/antelopev2.zip \ && unzip -q /tmp/antelopev2.zip -d models/insightface/models/antelopev2 \ && rm /tmp/antelopev2.zip -RUN wget -q -O /root/.cache/facexlib/weights/detection_Resnet50_Final.pth \ - https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth \ - && cp /root/.cache/facexlib/weights/detection_Resnet50_Final.pth models/facexlib/ - # Download checkpoints/vae/unet/clip models to include in image based on model type RUN if [ "$MODEL_TYPE" = "sdxl" ]; then \ wget -q -O models/checkpoints/sd_xl_base_1.0.safetensors https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors && \ @@ -234,10 +222,6 @@ FROM base AS final # Copy models from stage 2 to the final image COPY --from=downloader /comfyui/models /comfyui/models -# PULID: facexlib looks in ~/.cache at runtime; copy only that subdirectory, not -# all of /root/.cache, which also holds uv's multi-GB wheel cache. -COPY --from=downloader /root/.cache/facexlib /root/.cache/facexlib - # PULID: insightface resolves models from ~/.insightface/models at runtime RUN mkdir -p /root/.insightface \ && ln -s /comfyui/models/insightface/models /root/.insightface/models From 6f0d0c8899a93d8a222a774b80eeb9f125b8b68a Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Thu, 3 Sep 2026 15:36:26 +0200 Subject: [PATCH 13/14] Update Dockerfile --- Dockerfile | 41 +++-------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1c41550b..b7ba4ae0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,11 +23,8 @@ ENV CMAKE_BUILD_PARALLEL_LEVEL=8 RUN apt-get update && apt-get install -y \ python3.12 \ python3.12-venv \ - python3.12-dev \ - build-essential \ git \ wget \ - unzip \ libgl1 \ libglib2.0-0 \ libsm6 \ @@ -53,9 +50,7 @@ ENV PATH="/opt/venv/bin:${PATH}" # Install comfy-cli + dependencies needed by it to install ComfyUI # comfy-cli is pinned: its install/torch-index behavior decides what lands in # the workspace venv, so an unpinned version makes builds non-reproducible. -# PULID: cython and numpy must exist in THIS venv before insightface is -# installed below with --no-build-isolation. -RUN uv pip install comfy-cli==1.13.0 pip setuptools wheel cython "numpy<2.0.0" +RUN uv pip install comfy-cli==1.13.0 pip setuptools wheel # Install ComfyUI RUN if [ -n "${CUDA_VERSION_FOR_COMFY}" ]; then \ @@ -64,11 +59,6 @@ RUN if [ -n "${CUDA_VERSION_FOR_COMFY}" ]; then \ /usr/bin/yes | comfy --workspace /comfyui install --version "${COMFYUI_VERSION}" --nvidia; \ fi -# PULID: clone before the dependency step so the custom_nodes/*/requirements.txt -# loop below picks up its requirements too. -RUN git clone https://github.com/lldacing/ComfyUI_PuLID_Flux_ll.git \ - /comfyui/custom_nodes/ComfyUI_PuLID_Flux_ll - # Upgrade PyTorch if needed (for newer CUDA versions) RUN if [ "$ENABLE_PYTORCH_UPGRADE" = "true" ]; then \ uv pip install --force-reinstall torch torchvision torchaudio --index-url ${PYTORCH_INDEX_URL}; \ @@ -102,10 +92,7 @@ RUN uv pip install torch==2.11.0 torchvision==0.26.0 torchaudio==2.11.0 \ && for r in /comfyui/custom_nodes/*/requirements.txt; do \ [ -f "$r" ] && uv pip install -r "$r" || true; \ done \ - && uv pip install onnxruntime-gpu open-clip-torch facexlib \ - && uv pip install insightface --no-build-isolation \ - && uv pip install facenet-pytorch --no-deps \ - && uv pip install "transformers>=4.50.3,<5" "huggingface-hub<1.0" "numpy<2.0.0" + && uv pip install "transformers>=4.50.3,<5" "huggingface-hub<1.0" # Build-time smoke test: actually start ComfyUI (imports the full node graph) so # a startup-breaking dependency is caught HERE, at build time, instead of as a @@ -154,25 +141,7 @@ ARG MODEL_TYPE=fluxed-up WORKDIR /comfyui # Create necessary directories upfront -RUN mkdir -p models/checkpoints models/vae models/unet models/clip models/text_encoders models/diffusion_models models/model_patches \ - models/pulid \ - models/insightface/models/antelopev2 - -# PULID: adapter weights, EVA-CLIP, antelopev2. Unconditional — needed for any -# MODEL_TYPE. NOTE: nothing here writes to /root/.cache. RunPod's builder owns -# that path (see the "Creating cache directory" build step) and a Dockerfile -# that writes into it or COPY --from=s out of it fails the build before any -# instruction runs. facexlib fetches its detector at first use instead. -RUN wget -q -O models/pulid/PuLID-FLUX-v0.9.1.safetensors \ - https://huggingface.co/guozinan/PuLID/resolve/main/PuLID-FLUX-v0.9.1.safetensors - -RUN wget -q -O models/clip/EVA02_CLIP_L_336_psz14_s6B.pt \ - https://huggingface.co/QuanSun/EVA-CLIP/resolve/main/EVA02_CLIP_L_336_psz14_s6B.pt - -RUN wget -q -O /tmp/antelopev2.zip \ - https://huggingface.co/MONA-LISA/antelopev2/resolve/main/antelopev2.zip \ - && unzip -q /tmp/antelopev2.zip -d models/insightface/models/antelopev2 \ - && rm /tmp/antelopev2.zip +RUN mkdir -p models/checkpoints models/vae models/unet models/clip models/text_encoders models/diffusion_models models/model_patches # Download checkpoints/vae/unet/clip models to include in image based on model type RUN if [ "$MODEL_TYPE" = "sdxl" ]; then \ @@ -221,7 +190,3 @@ FROM base AS final # Copy models from stage 2 to the final image COPY --from=downloader /comfyui/models /comfyui/models - -# PULID: insightface resolves models from ~/.insightface/models at runtime -RUN mkdir -p /root/.insightface \ - && ln -s /comfyui/models/insightface/models /root/.insightface/models From d5c3b55c203ac94cd9dddaad7aecb89870fb130b Mon Sep 17 00:00:00 2001 From: rickymalovalo1-create Date: Fri, 4 Sep 2026 14:28:02 +0200 Subject: [PATCH 14/14] Update hub.json --- .runpod/hub.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.runpod/hub.json b/.runpod/hub.json index bc8d1981..f8f42494 100644 --- a/.runpod/hub.json +++ b/.runpod/hub.json @@ -6,7 +6,7 @@ "iconUrl": "https://cpjrphpz3t5wbwfe.public.blob.vercel-storage.com/comfy-ui.png", "config": { "runsOn": "GPU", - "containerDiskInGb": 20, + "containerDiskInGb": 40, "gpuIds": "ADA_24", "gpuCount": 1, "allowedCudaVersions": ["12.8", "12.9", "13.0", "13.1", "13.2"],