# imagelab-runpod ComfyUI Docker image for RunPod, built around the **imagelab_v3_extension** custom node. Model downloading is owned by the extension (`CIVITAI_TOKEN` + `IMAGELAB_AUTO_DOWNLOAD`); this image only sets up the runtime and the small set of custom nodes the ImageLab web app's workflow graph needs. ## What's inside - `nvidia/cuda:12.8.1-cudnn-devel-ubuntu24.04` base - PyTorch nightly w/ CUDA 12.8 — required for Blackwell (B200 / 5090) GPUs; works on Hopper / Ampere / consumer cards too - Triton + SageAttention (installed in background at boot; auto-enabled when present) - ComfyUI launched with `--preview-method taesd --preview-size 768 --enable-cors-header` so the web app sees live previews ### Custom nodes installed **Required by the web app's graph:** | Node | Why | | --- | --- | | `imagelab_v3_extension` | `/imagelab/*` API — model hashing, CivitAI lookups + downloads, model delete | | `ComfyUI-Inpaint-CropAndStitch` | `InpaintCropImproved` / `InpaintStitchImproved` (canvas inpaint pipeline) | | `ComfyUI-BRIA_AI-RMBG` | `BRIA_RMBG_ModelLoader_Zho` / `BRIA_RMBG_Zho` (Remove BG post step) | | `ComfyUI-WD14-Tagger` | `WD14Tagger\|pysssss` (legacy auto-tag path; harmless if unused) | | `ComfyUI_UltimateSDUpscale` | `UltimateSDUpscale` (the Ultimate SD Upscale pass) | | `comfyui_controlnet_aux` | `AIO_Preprocessor` + preprocessors (the ControlNet pass) | **QoL / general-purpose** (carried over from the previous image, no specific graph dependency — installed so user workflows assembled in ComfyUI Manager don't immediately hit "missing nodes"): | Node | Why | | --- | --- | | `ComfyUI-Manager` | In-UI node manager | | `ComfyUI-Custom-Scripts` | pythongosssss QoL helpers | | `cg-use-everywhere` | "Use everywhere" wireless routing | | `rgthree-comfy` | Reroute / fast groups / nicer UI | | `ComfyUI_essentials` | cubiq utility nodes a lot of community workflows assume | | `ComfyUI_IPAdapter_plus` | IP-Adapter | | `ComfyUI-Impact-Pack` | ImpactPack — detectors, samplers, segmentation | | `ComfyUI-VideoHelperSuite` | Video load/save helpers | | `was-node-suite-comfyui` | WAS — broad utility node set | | `ComfyUI_experiments` | comfyanonymous's experimental nodes | | `ComfyUI_JPS-Nodes` | JPS utility nodes | | `comfyui-various` | jamesWalker55 utility nodes | | `comfyui-tooling-nodes` | Acly Krita-AI tooling nodes | The BRIA RMBG-1.4 model is downloaded at first boot into the node's `RMBG-1.4` folder (HF; works without auth, but pass `HF_TOKEN` if you've been rate-limited). At first boot the image also prefetches from HuggingFace (existence-checked, so once per volume): TAESD-XL + SDXL VAE, the **xinsir ControlNet-Union-SDXL (Promax)** → `models/controlnet/xinsir-controlnet-union-sdxl-promax.safetensors` (drives the ControlNet pass, incl. Tile-based hi-res upscaling), and **RealESRGAN_x4** → `models/upscale_models/` (a default for the Ultimate SD Upscale pass). Each is a `log_warn`-on-failure best effort — a failed pull doesn't block boot. ## Environment variables | Var | Default | Effect | | --- | --- | --- | | `CIVITAI_TOKEN` | unset | Read by the extension. **Required** for any gated CivitAI download. | | `IMAGELAB_AUTO_DOWNLOAD` | unset | Comma/newline list the extension queues at server start (CivitAI version ids, model ids, full URLs, or `::` overrides). | | `HF_TOKEN` | unset | Used by the BRIA RMBG download if HuggingFace rate-limits anon. | | `SAGE_ATTENTION` | `true` | `false` to skip install + `--use-sage-attention` entirely. | | `COMFYUI_ARGS` | (auto) | Override the auto-derived ComfyUI args completely. | ## Building locally ```bash docker build -t imagelab-runpod . docker run --gpus all -p 8188:8188 \ -e CIVITAI_TOKEN=... \ -e IMAGELAB_AUTO_DOWNLOAD=... \ -v /path/to/models:/workspace/ComfyUI/models \ imagelab-runpod ``` ## CI / publishing `.gitea/workflows/build.yml` builds + pushes the image to `gitea.dev.blueoceanswim.com/donny/imagelab-runpod` on every push to `main` and on every `v*` tag: - `:latest` — every main build - `:` — every build - `:` — when a `v*` tag is pushed Needs a `REGISTRY_TOKEN` secret (a Gitea PAT with `write:package` scope) on the repo. Gitea reserves the `GITEA_` prefix for built-in secrets, so the workflow uses `REGISTRY_TOKEN` instead. ## Pointing RunPod at the image In RunPod, pick **Custom Template**, set the image to `gitea.dev.blueoceanswim.com/donny/imagelab-runpod:latest`, expose port `8188`, mount your volume at `/workspace/ComfyUI/models`, and set the env vars above. ## GPU notes The startup script reads `nvidia-smi` and picks ComfyUI flags by VRAM bucket: | VRAM | Precision | Notes | | --- | --- | --- | | ≥ 180 GB | `--bf16-vae --bf16-unet` | B200 / GB200 | | ≥ 80 GB | `--bf16-vae --bf16-unet` | H100 / H200 | | ≥ 40 GB | `--fp16-vae --fp16-unet` | A100 | | ≥ 20 GB | `--fp16-vae --fp16-unet` | RTX 3090 / 4090 / 5090 | | < 20 GB | `--lowvram` | anything smaller | When SageAttention is installed (default), `--use-sage-attention` is added automatically.