From 623ba5db998b7fa6abb04639f6236978f4b44574 Mon Sep 17 00:00:00 2001 From: owl Date: Tue, 22 Oct 2024 03:36:39 +0700 Subject: [PATCH] download some custom nodes i usually need --- Dockerfile | 9 +++++++-- README.md | 3 ++- cmd.sh | 10 +++++++++- comfyui.log | 0 docker-compose.yml | 3 +++ nodes_download.bash | 37 +++++++++++++++++++++++++++++++++++++ 6 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 comfyui.log create mode 100644 nodes_download.bash diff --git a/Dockerfile b/Dockerfile index 743cdc7..8cdcdab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,8 +16,10 @@ VOLUME [ \ "/ComfyUI/models", \ "/ComfyUI/input", \ "/ComfyUI/output", \ - "/ComfyUI/custom_nodes" \ - ] + "/ComfyUI/custom_nodes", \ + "/ComfyUI/my_workflows", \ + "/ComfyUI_temp" \ + ] RUN pip3 install --upgrade pip \ && pip3 install -r requirements.txt @@ -29,6 +31,9 @@ COPY ./cmd.sh / RUN chmod +x /cmd.sh +COPY ./nodes_download.bash / + +RUN bash /nodes_download.bash RUN cp -TR "/ComfyUI/models" /tmp_models RUN cp -TR "/ComfyUI/input" /tmp_input diff --git a/README.md b/README.md index e0c81c2..2396ea4 100644 --- a/README.md +++ b/README.md @@ -3,5 +3,6 @@ Dockerfile for ComfyUI No automatic downloads of terabytes of models, no manager, no custom nodes, no nothing. It's just comfy. +(I lied, there are some custom nodes defined in nodes_download.bash, you can delete them if you wish so) -Only works on nvidia (container uses cuda 12.6.1), for the sake of simplicity and because i have no other gpus. \ No newline at end of file +Only works on nvidia (container uses cuda 12.6.1), for the sake of simplicity and because i have no other gpus. diff --git a/cmd.sh b/cmd.sh index 54b823d..4f64b17 100644 --- a/cmd.sh +++ b/cmd.sh @@ -5,4 +5,12 @@ cp -r --update /tmp_input/* /ComfyUI/input cp -r --update /tmp_output/* /ComfyUI/output cp -r --update /tmp_custom_nodes/* /ComfyUI/custom_nodes -python3 /ComfyUI/main.py --listen +chown -R 1000:1000 /ComfyUI/models +chown -R 1000:1000 /ComfyUI/input +chown -R 1000:1000 /ComfyUI/output +chown -R 1000:1000 /ComfyUI/custom_nodes +chown -R 1000:1000 /ComfyUI/my_workflows +chown -R 1000:1000 /ComfyUI_temp + + +python3 /ComfyUI/main.py --listen --temp-directory /ComfyUI_temp diff --git a/comfyui.log b/comfyui.log new file mode 100644 index 0000000..e69de29 diff --git a/docker-compose.yml b/docker-compose.yml index 957277a..28dd2d3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,9 @@ services: - ./custom_nodes/:/ComfyUI/custom_nodes/ - ./output:/ComfyUI/output - ./input:/ComfyUI/input + - ./my_workflows:/ComfyUI/my_workflows + - ./ComfyUI_temp:/ComfyUI_temp + - ./comfyui.log:/ComfyUI/comfyui.log environment: - NVIDIA_VISIBLE_DEVICES=all diff --git a/nodes_download.bash b/nodes_download.bash new file mode 100644 index 0000000..93c4077 --- /dev/null +++ b/nodes_download.bash @@ -0,0 +1,37 @@ +#!/bin/bash + +export PIP_ROOT_USER_ACTION=ignore + +# The list of nodes +NODES=( + "https://github.com/ciri/comfyui-model-downloader.git comfyui-model-downloader" + "https://github.com/11cafe/comfyui-workspace-manager.git comfyui-workspace-manager" + "https://github.com/ltdrdata/ComfyUI-Manager.git ComfyUI-Manager" +) + +# Node install function +clone_and_install() { + + cd /ComfyUI/custom_nodes + + for repo in "${NODES[@]}"; do + url=$(echo "$repo" | cut -d' ' -f1) + name=$(echo "$repo" | cut -d' ' -f2) + + if [ ! -d "$name" ] || [ -z "$(ls -A "$name")" ]; then + echo "Cloning $name..." + git clone "$url" "$name" + + if [ -f "$name/requirements.txt" ]; then + echo "Installing requirements for $name..." + cd "$name" + pip install -r requirements.txt + cd .. + fi + else + echo "Skipping $name, folder is not empty or already exists." + fi + done +} + +clone_and_install