Enable Jupyter and file tools by default with recipe flags

This commit is contained in:
kflame99
2026-02-15 12:37:59 +00:00
parent 3f417a09da
commit bb607ada7d
7 changed files with 80 additions and 9 deletions
+11 -1
View File
@@ -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"]
+19
View File
@@ -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"
+21 -6
View File
@@ -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.
+2
View File
@@ -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
+16 -2
View File
@@ -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`
@@ -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
@@ -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}')