File size: 6,510 Bytes
e174bd3 139a78d c332cc2 6e59ca4 e174bd3 e373e42 6507f17 139a78d c332cc2 6e59ca4 e373e42 6507f17 e174bd3 c332cc2 e174bd3 6507f17 e174bd3 c332cc2 e174bd3 139a78d 6e59ca4 e174bd3 c332cc2 e373e42 6507f17 e373e42 c332cc2 6507f17 c332cc2 6e59ca4 c332cc2 6e59ca4 139a78d 6e59ca4 e174bd3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | # ComfyUI Qwen-Image-Edit base image (H100 / RunPod)
#
# NOTE: published plx1029/comfyui-qwen tags were NOT built from this file — they
# were assembled daemonlessly (v1: crane append on the pod; v2: skopeo + umoci;
# v3: crane append of a /workspace layer on top of v2; v4 and v5: further
# crane appends). This Dockerfile is the reproducible equivalent: building it
# on any machine with Docker produces the same setup.
#
# Build from the REPO ROOT (context needs download_missing_models.sh + workflows/
# + start_comfy + claude_start.sh + apply_patches.sh):
# docker build -t plx1029/comfyui-qwen:v7 -f docker/Dockerfile .
# docker push plx1029/comfyui-qwen:v7
#
# No secrets are baked into this image (it is public). The model-download
# script prompts for your Hugging Face token at runtime (or reads $HF_TOKEN).
#
# v3: EVERYTHING lives in /workspace — /workspace/ComfyUI, /workspace/workflows,
# /workspace/download_missing_models.sh. A compressed seed of the /workspace
# payload is kept at /opt/workspace-seed.tar.gz so that when a network volume
# is mounted over /workspace (shadowing the baked files), seed-workspace.sh
# restores the missing pieces without touching anything already on the volume.
#
# v4: ComfyUI no longer auto-starts (COMFY_AUTOSTART=true re-enables);
# download_missing_models.sh + README.md are re-fetched from the HF repo at
# boot.
#
# v5: the boot refresh lives in refresh-workspace.sh and now also MIRRORS
# workflows/ from hf.co/aleph65/ComfyUI (deletions included; uses
# HUGGING_FACE_ACCESS_TOKEN or HF_TOKEN if set; WORKSPACE_REFRESH=false
# disables). Also: interactive `claude` is aliased to
# `IS_SANDBOX=1 claude --dangerously-skip-permissions`.
#
# v6: two launcher scripts baked into /workspace and re-fetched from the HF
# repo at boot (via refresh-workspace.sh) — `start_comfy` (frees port 7865 then
# runs ComfyUI with the manager) and `claude_start.sh` (IS_SANDBOX=1 claude
# --dangerously-skip-permissions).
#
# v7: apply_patches.sh baked in + run at build, and re-run at launch by
# start_comfy (so existing pods self-heal off the HF copy). Fixes ComfyUI
# #14573 — the comfy-aimdo/DynamicVRAM sampler hang at "Model Initializing"
# (and its slow loads) by patching model_management.py's NVIDIA
# MIN_WEIGHT_MEMORY_RATIO 0.0 -> 0.4. With the patch, DynamicVRAM is safe, so
# start_comfy no longer disables it. Remove the patch once #14573 lands upstream.
FROM runpod/pytorch:1.0.2-cu1281-torch280-ubuntu2404
ARG COMFYUI_COMMIT=35c1470935044be5610a81d46e57922a8a598c6c
ARG RGTHREE_COMMIT=27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383
# ComfyUI pinned to the exact commit, IN /workspace; torch stack already in
# base -> only light deps install
RUN git clone https://github.com/comfyanonymous/ComfyUI.git /workspace/ComfyUI && \
cd /workspace/ComfyUI && git checkout ${COMFYUI_COMMIT} && \
pip install -r requirements.txt
# v7: apply local core patches upstream hasn't merged (ComfyUI #14573 aimdo
# hang). Idempotent; start_comfy also re-runs it at launch from the HF copy.
COPY apply_patches.sh /workspace/apply_patches.sh
RUN chmod +x /workspace/apply_patches.sh && bash /workspace/apply_patches.sh
# Custom nodes: rgthree (Power Lora Loader) + ComfyUI-Manager
RUN git clone https://github.com/rgthree/rgthree-comfy.git /workspace/ComfyUI/custom_nodes/rgthree-comfy && \
cd /workspace/ComfyUI/custom_nodes/rgthree-comfy && git checkout ${RGTHREE_COMMIT} && \
pip install comfyui-manager==4.2.2
# Hugging Face hub tooling for fast model downloads (hf_transfer is best-effort:
# hub >= 1.x ships fast Xet downloads built in and dropped the extra)
RUN pip install -U "huggingface_hub[hf_transfer]" || pip install -U huggingface_hub && \
(pip install hf_transfer || true)
# Claude Code CLI, on PATH for all shells, with bypassPermissions as the
# default permission mode (this is a throwaway pod environment)
RUN curl -fsSL https://claude.ai/install.sh | bash && \
ln -sf /root/.local/bin/claude /usr/local/bin/claude && \
mkdir -p /root/.claude && \
printf '{\n "permissions": {\n "defaultMode": "bypassPermissions"\n }\n}\n' > /root/.claude/settings.json && \
printf '{\n "bypassPermissionsModeAccepted": true\n}\n' > /root/.claude.json
ENV PATH="/root/.local/bin:${PATH}"
# Interactive shells: `claude` always runs sandboxed with permissions skipped
# (/root/.bashrc from the base image sources ~/.bash_aliases when present)
COPY docker/bash_aliases /root/.bash_aliases
# Manager config baked in: security_level=weak, network_mode=personal_cloud
COPY docker/config.ini /workspace/ComfyUI/user/__manager/config.ini
COPY docker/comfy.settings.json /workspace/ComfyUI/user/default/comfy.settings.json
COPY workflows/ /workspace/ComfyUI/user/default/workflows/
# Workflows + model downloader live in /workspace too. The downloader picks
# workflows, finds their models in the HF repo (aleph65/ComfyUI), and downloads
# the missing ones into /workspace/ComfyUI/models/. Prompts for the HF token
# (or reads $HF_TOKEN). Kept on PATH via a symlink.
COPY workflows/ /workspace/workflows/
COPY download_missing_models.sh /workspace/download_missing_models.sh
RUN chmod +x /workspace/download_missing_models.sh && \
ln -sf /workspace/download_missing_models.sh /usr/local/bin/download_missing_models.sh
# v6: launcher scripts in /workspace. start_comfy kills whatever holds port
# 7865, applies core patches, then runs ComfyUI (--enable-manager);
# claude_start.sh launches Claude Code sandboxed. refresh-workspace.sh re-pulls
# both from the HF repo at boot.
COPY start_comfy /workspace/start_comfy
COPY claude_start.sh /workspace/claude_start.sh
RUN chmod +x /workspace/start_comfy /workspace/claude_start.sh
# Seed tarball: restores /workspace when a network volume shadows it
RUN tar -czf /opt/workspace-seed.tar.gz -C /workspace ComfyUI workflows download_missing_models.sh start_comfy claude_start.sh apply_patches.sh
# Startup: seed /workspace if needed, refresh workflows + downloader from the
# HF repo (v5). ComfyUI does NOT auto-start (v4 default) — run `comfy`
# manually or set COMFY_AUTOSTART=true in the pod env.
COPY docker/seed-workspace.sh /usr/local/bin/seed-workspace.sh
COPY docker/refresh-workspace.sh /usr/local/bin/refresh-workspace.sh
COPY docker/comfy /usr/local/bin/comfy
COPY docker/start-comfy.sh /start-comfy.sh
RUN chmod +x /usr/local/bin/comfy /usr/local/bin/seed-workspace.sh /usr/local/bin/refresh-workspace.sh /start-comfy.sh
EXPOSE 7865
CMD ["/start-comfy.sh"]
|