From bb607ada7d5c2090b6acf4fbfd6830b78c01d717 Mon Sep 17 00:00:00 2001 From: kflame99 <261674183+kflame99@users.noreply.github.com> Date: Sun, 15 Feb 2026 12:37:59 +0000 Subject: [PATCH] Enable Jupyter and file tools by default with recipe flags --- Runpod_Comfy/core/docker/Dockerfile | 12 ++++++++- Runpod_Comfy/core/docker/start.sh | 19 +++++++++++++ Runpod_Comfy/image/DEPLOY_RUNPOD.md | 27 ++++++++++++++----- Runpod_Comfy/image/active/comfyui.lock | 2 ++ Runpod_Comfy/setup/USER_README.md | 18 +++++++++++-- .../recipes/examples/runpod.example.yaml | 4 +++ Runpod_Comfy/setup/tools/compile_profile.sh | 7 +++++ 7 files changed, 80 insertions(+), 9 deletions(-) diff --git a/Runpod_Comfy/core/docker/Dockerfile b/Runpod_Comfy/core/docker/Dockerfile index 03fc462..7d70195 100644 --- a/Runpod_Comfy/core/docker/Dockerfile +++ b/Runpod_Comfy/core/docker/Dockerfile @@ -1,23 +1,33 @@ ARG BASE_IMAGE=runpod/pytorch:2.6.0-py3.11-cuda12.4.1-devel-ubuntu22.04 +ARG ENABLE_JUPYTER=true +ARG ENABLE_FILE_TOOLS=true FROM ${BASE_IMAGE} ENV DEBIAN_FRONTEND=noninteractive \ PIP_DISABLE_PIP_VERSION_CHECK=1 \ PYTHONUNBUFFERED=1 \ COMFYUI_PORT=8188 \ + JUPYTER_PORT=8888 \ + JUPYTER_TOKEN=runpod \ COMFYUI_WORKDIR=/workspace/ComfyUI \ RUNPOD_VOLUME_ROOT=/workspace WORKDIR /opt/bootstrap +ARG ENABLE_JUPYTER +ARG ENABLE_FILE_TOOLS + RUN apt-get update && apt-get install -y --no-install-recommends \ git curl ca-certificates jq \ + && if [ "$ENABLE_FILE_TOOLS" = "true" ]; then apt-get install -y --no-install-recommends zip unzip p7zip-full rsync; fi \ && rm -rf /var/lib/apt/lists/* +RUN if [ "$ENABLE_JUPYTER" = "true" ]; then python3 -m pip install --no-cache-dir jupyterlab; fi + COPY Runpod_Comfy /opt/bootstrap/Runpod_Comfy RUN chmod +x /opt/bootstrap/Runpod_Comfy/core/scripts/*.sh /opt/bootstrap/Runpod_Comfy/core/docker/start.sh -EXPOSE 8188 +EXPOSE 8188 8888 ENTRYPOINT ["/opt/bootstrap/Runpod_Comfy/core/docker/start.sh"] diff --git a/Runpod_Comfy/core/docker/start.sh b/Runpod_Comfy/core/docker/start.sh index 959e81f..375d98d 100755 --- a/Runpod_Comfy/core/docker/start.sh +++ b/Runpod_Comfy/core/docker/start.sh @@ -4,9 +4,28 @@ set -euo pipefail ROOT=/opt/bootstrap/Runpod_Comfy WORKDIR="${COMFYUI_WORKDIR:-/workspace/ComfyUI}" PORT="${COMFYUI_PORT:-8188}" +JUPYTER_PORT="${JUPYTER_PORT:-8888}" +JUPYTER_TOKEN="${JUPYTER_TOKEN:-runpod}" "$ROOT/core/scripts/bootstrap.sh" +if [[ -f "$ROOT/image/active/comfyui.lock" ]]; then + # shellcheck disable=SC1091 + source "$ROOT/image/active/comfyui.lock" +fi + +if [[ "${ENABLE_JUPYTER:-true}" == "true" ]]; then + echo "[jupyter] starting on 0.0.0.0:${JUPYTER_PORT}" + jupyter lab \ + --ip=0.0.0.0 \ + --port "$JUPYTER_PORT" \ + --no-browser \ + --allow-root \ + --IdentityProvider.token="$JUPYTER_TOKEN" \ + --ServerApp.root_dir="$WORKDIR" \ + >/tmp/jupyter.log 2>&1 & +fi + cd "$WORKDIR" exec python3 main.py --listen 0.0.0.0 --port "$PORT" diff --git a/Runpod_Comfy/image/DEPLOY_RUNPOD.md b/Runpod_Comfy/image/DEPLOY_RUNPOD.md index c4376ef..fa0adb4 100644 --- a/Runpod_Comfy/image/DEPLOY_RUNPOD.md +++ b/Runpod_Comfy/image/DEPLOY_RUNPOD.md @@ -7,19 +7,33 @@ Use GitHub Container Registry or Docker Hub. Example (GHCR): ```bash -docker build -t ghcr.io/malkuthro/comfyui-koolook:runpod-v1 -f Runpod_Comfy/core/docker/Dockerfile . -docker push ghcr.io/malkuthro/comfyui-koolook:runpod-v1 +BASE_IMAGE=$(grep '^BASE_IMAGE=' Runpod_Comfy/image/active/comfyui.lock | cut -d= -f2-) +IMAGE_NAME=$(grep '^IMAGE_NAME=' Runpod_Comfy/image/active/comfyui.lock | cut -d= -f2-) +IMAGE_TAG=$(grep '^RUNPOD_IMAGE_TAG=' Runpod_Comfy/image/active/comfyui.lock | cut -d= -f2-) +ENABLE_JUPYTER=$(grep '^ENABLE_JUPYTER=' Runpod_Comfy/image/active/comfyui.lock | cut -d= -f2-) +ENABLE_FILE_TOOLS=$(grep '^ENABLE_FILE_TOOLS=' Runpod_Comfy/image/active/comfyui.lock | cut -d= -f2-) + +docker build \ + --build-arg BASE_IMAGE="$BASE_IMAGE" \ + --build-arg ENABLE_JUPYTER="$ENABLE_JUPYTER" \ + --build-arg ENABLE_FILE_TOOLS="$ENABLE_FILE_TOOLS" \ + -t ${IMAGE_NAME}:${IMAGE_TAG} \ + -f Runpod_Comfy/core/docker/Dockerfile . + +docker push ${IMAGE_NAME}:${IMAGE_TAG} ``` ## 2) Create RunPod template - Container image: `ghcr.io/malkuthro/comfyui-koolook:runpod-v1` -- Exposed HTTP port: `8188` +- Exposed HTTP ports: `8188` (ComfyUI), `8888` (JupyterLab) - Volume mount: `/workspace` (recommended) ## 3) Optional env vars - `COMFYUI_PORT=8188` +- `JUPYTER_PORT=8888` +- `JUPYTER_TOKEN=...` (default in image is `runpod`) - `COMFYUI_WORKDIR=/workspace/ComfyUI` - `HF_TOKEN=...` (if needed) - `CIVITAI_TOKEN=...` (if needed) @@ -27,8 +41,9 @@ docker push ghcr.io/malkuthro/comfyui-koolook:runpod-v1 ## 4) First boot expectations On first start: -- ComfyUI is cloned at pinned ref from `config/comfyui.lock` -- custom nodes are installed from `config/custom_nodes.lock.json` -- models are downloaded from `config/models.json` (enabled entries only) +- ComfyUI is cloned at pinned ref from `image/active/comfyui.lock` +- custom nodes are installed from `image/active/custom_nodes.lock.json` +- models are downloaded from `image/active/models.json` (enabled entries only) +- JupyterLab starts automatically when `ENABLE_JUPYTER=true` Subsequent starts reuse existing files from volume storage. diff --git a/Runpod_Comfy/image/active/comfyui.lock b/Runpod_Comfy/image/active/comfyui.lock index 6afeb27..c3c0d9a 100644 --- a/Runpod_Comfy/image/active/comfyui.lock +++ b/Runpod_Comfy/image/active/comfyui.lock @@ -3,5 +3,7 @@ RECIPE_ID=example BASE_IMAGE=runpod/pytorch:2.6.0-py3.11-cuda12.4.1-devel-ubuntu22.04 IMAGE_NAME=ghcr.io/your-user/comfyui-koolook RUNPOD_IMAGE_TAG=upscaler-v1.0.0 +ENABLE_JUPYTER=true +ENABLE_FILE_TOOLS=true COMFYUI_REPO=https://github.com/comfyanonymous/ComfyUI.git COMFYUI_REF=master diff --git a/Runpod_Comfy/setup/USER_README.md b/Runpod_Comfy/setup/USER_README.md index ebf4826..f368c6c 100644 --- a/Runpod_Comfy/setup/USER_README.md +++ b/Runpod_Comfy/setup/USER_README.md @@ -20,6 +20,11 @@ Creates: - `Runpod_Comfy/setup/recipes/upscaler-v1/models.yaml` - `Runpod_Comfy/setup/recipes/upscaler-v1/urls.txt` +In `runpod.yaml`, feature defaults are ON: +- `features.enable_jupyter: true` +- `features.enable_file_tools: true` +Set either to `false` to disable. + ### 2) Compile recipe ```bash @@ -41,10 +46,19 @@ By default compile also **activates** to: ```bash BASE_IMAGE=$(grep '^BASE_IMAGE=' Runpod_Comfy/image/active/comfyui.lock | cut -d= -f2-) IMAGE_TAG=$(grep '^RUNPOD_IMAGE_TAG=' Runpod_Comfy/image/active/comfyui.lock | cut -d= -f2-) -docker build --build-arg BASE_IMAGE="$BASE_IMAGE" \ - -t comfyui-koolook:${IMAGE_TAG} -f Runpod_Comfy/core/docker/Dockerfile . +ENABLE_JUPYTER=$(grep '^ENABLE_JUPYTER=' Runpod_Comfy/image/active/comfyui.lock | cut -d= -f2-) +ENABLE_FILE_TOOLS=$(grep '^ENABLE_FILE_TOOLS=' Runpod_Comfy/image/active/comfyui.lock | cut -d= -f2-) + +docker build \ + --build-arg BASE_IMAGE="$BASE_IMAGE" \ + --build-arg ENABLE_JUPYTER="$ENABLE_JUPYTER" \ + --build-arg ENABLE_FILE_TOOLS="$ENABLE_FILE_TOOLS" \ + -t comfyui-koolook:${IMAGE_TAG} \ + -f Runpod_Comfy/core/docker/Dockerfile . ``` +By default both `ENABLE_JUPYTER` and `ENABLE_FILE_TOOLS` are `true`. + ## Iterate safely - Minor tweaks: keep same recipe id, bump `image_tag` in `runpod.yaml` diff --git a/Runpod_Comfy/setup/recipes/examples/runpod.example.yaml b/Runpod_Comfy/setup/recipes/examples/runpod.example.yaml index 9556a05..f95ffb9 100644 --- a/Runpod_Comfy/setup/recipes/examples/runpod.example.yaml +++ b/Runpod_Comfy/setup/recipes/examples/runpod.example.yaml @@ -7,6 +7,10 @@ base_image: runpod/pytorch:2.6.0-py3.11-cuda12.4.1-devel-ubuntu22.04 image_name: ghcr.io/your-user/comfyui-koolook image_tag: upscaler-v1.0.0 +features: + enable_jupyter: true + enable_file_tools: true + comfyui: repo: https://github.com/comfyanonymous/ComfyUI.git ref: master diff --git a/Runpod_Comfy/setup/tools/compile_profile.sh b/Runpod_Comfy/setup/tools/compile_profile.sh index 93ed578..470a498 100755 --- a/Runpod_Comfy/setup/tools/compile_profile.sh +++ b/Runpod_Comfy/setup/tools/compile_profile.sh @@ -117,6 +117,9 @@ base_image=runpod.get('base_image'); comfy=runpod.get('comfyui',{}) if isinstanc if not base_image: raise ValueError('base_image is required') image_name=runpod.get('image_name','') image_tag= image_tag_override or runpod.get('image_tag', recipe_id) +features = runpod.get('features', {}) if isinstance(runpod.get('features'), dict) else {} +enable_jupyter = bool(features.get('enable_jupyter', True)) +enable_file_tools = bool(features.get('enable_file_tools', True)) nodes=nodes_data.get('nodes',[]); models=models_data.get('models',[]) url_models=parse_urls(urls_path) for n in nodes: @@ -135,6 +138,8 @@ comfy_lock='\n'.join([ f'BASE_IMAGE={base_image}', f'IMAGE_NAME={image_name}', f'RUNPOD_IMAGE_TAG={image_tag}', + f'ENABLE_JUPYTER={str(enable_jupyter).lower()}', + f'ENABLE_FILE_TOOLS={str(enable_file_tools).lower()}', f"COMFYUI_REPO={comfy.get('repo','https://github.com/comfyanonymous/ComfyUI.git')}", f"COMFYUI_REF={comfy.get('ref','master')}", '' @@ -148,6 +153,8 @@ print(f'Base image : {base_image}') print(f'Image name : {image_name or "(unset)"}') print(f'Image tag : {image_tag}') print(f'ComfyUI ref : {comfy.get("ref","master")}') +print(f'Jupyter : {enable_jupyter}') +print(f'File tools : {enable_file_tools}') print(f'Custom nodes : {len(nodes)}') print(f'Models : {len(models)} (urls.txt additions: {len(url_models)})') print(f'Output dir : {out_dir}')