better comfy
This commit is contained in:
1 parent
bdc74bc4d2
commit
431174cd19
3 files changed
+66
-8
No files matched your search
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
# init.sh – runs inside the ComfyUI Docker container
|
||||
#
|
||||
# 1. Checks whether each custom node directory exists.
|
||||
# 2. If a node is missing, it is cloned from its repository
|
||||
# and its Python dependencies are installed via pip.
|
||||
# 3. Finally, the script hands control over to the ComfyUI server
|
||||
# (python main.py ...).
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# The base directory for ComfyUI – exported in the Dockerfile.
|
||||
COMFYUI_PATH=${COMFYUI_PATH:-/workspace/ComfyUI}
|
||||
|
||||
# Helper to clone and install a node only if it does not already exist.
|
||||
install_node() {
|
||||
local repo_url=$1
|
||||
local node_dir=$2
|
||||
local req_file=$3
|
||||
|
||||
if [ ! -d "$node_dir" ]; then
|
||||
echo "Cloning $repo_url into $node_dir ..."
|
||||
git clone "$repo_url" "$node_dir"
|
||||
|
||||
if [ -f "$req_file" ]; then
|
||||
echo "Installing dependencies for $node_dir ..."
|
||||
pip install --no-cache-dir -r "$req_file"
|
||||
else
|
||||
echo "No requirements file found for $node_dir; skipping pip install."
|
||||
fi
|
||||
else
|
||||
echo "$node_dir already exists; skipping clone."
|
||||
fi
|
||||
}
|
||||
|
||||
# 1️⃣ ComfyUI‑Manager
|
||||
install_node "https://github.com/ltdrdata/ComfyUI-Manager" \
|
||||
"$COMFYUI_PATH/custom_nodes/ComfyUI-Manager" \
|
||||
"$COMFYUI_PATH/custom_nodes/ComfyUI-Manager/requirements.txt"
|
||||
|
||||
# 2️⃣ WAN 2.1 Video Wrapper
|
||||
install_node "https://github.com/kijai/ComfyUI-WanVideoWrapper" \
|
||||
"$COMFYUI_PATH/custom_nodes/ComfyUI-WanVideoWrapper" \
|
||||
"$COMFYUI_PATH/custom_nodes/ComfyUI-WanVideoWrapper/requirements.txt"
|
||||
|
||||
# 3️⃣ Video Helper Suite
|
||||
install_node "https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite" \
|
||||
"$COMFYUI_PATH/custom_nodes/ComfyUI-VideoHelperSuite" \
|
||||
"$COMFYUI_PATH/custom_nodes/ComfyUI-VideoHelperSuite/requirements.txt"
|
||||
|
||||
# 4️⃣ Start the ComfyUI server
|
||||
echo "Starting ComfyUI..."
|
||||
exec python "$COMFYUI_PATH/main.py" \
|
||||
--listen 0.0.0.0 \
|
||||
--port 8188 \
|
||||
--use-pytorch-cross-attention
|
||||
@@ -11,9 +11,10 @@ let
|
||||
|
||||
# Load Containerfile from file
|
||||
containerfile = ./rocm.Containerfile;
|
||||
containerinitsh = ./init.sh;
|
||||
|
||||
# Image name and tag
|
||||
imageName = "comfyui-rocm";
|
||||
imageName = "nix-comfyui-rocm";
|
||||
imageTag = cfg.rocm.imageTag;
|
||||
fullImageName = "${imageName}:${imageTag}";
|
||||
in
|
||||
@@ -21,13 +22,13 @@ in
|
||||
options.skyg.nixos.server.services.comfyui.rocm = with lib; {
|
||||
uid = mkOption {
|
||||
type = types.int;
|
||||
default = 1000;
|
||||
default = 0;
|
||||
description = "User ID to run the ComfyUI container as";
|
||||
};
|
||||
|
||||
gid = mkOption {
|
||||
type = types.int;
|
||||
default = 100;
|
||||
default = 0;
|
||||
description = "Group ID to run the ComfyUI container as";
|
||||
};
|
||||
|
||||
@@ -111,6 +112,8 @@ in
|
||||
system.activationScripts.comfyui-rocm-build = {
|
||||
text = ''
|
||||
# Check if image exists or rebuild is requested
|
||||
# Note: init.sh is located next to the Dockerfile, so it is automatically
|
||||
# included in the Docker build context and no explicit copy step is needed.
|
||||
if ! ${pkgs.docker}/bin/docker image inspect ${fullImageName} > /dev/null 2>&1 || ${lib.boolToString cfg.rocm.rebuildImage}; then
|
||||
echo "Building ComfyUI ROCm Docker image..."
|
||||
${pkgs.docker}/bin/docker build \
|
||||
@@ -118,7 +121,7 @@ in
|
||||
--build-arg COMFYUI_COMMIT=${cfg.rocm.comfyuiCommit} \
|
||||
--build-arg HSA_OVERRIDE_GFX_VERSION=${cfg.rocm.hsaOverrideGfxVersion} \
|
||||
-f ${containerfile} \
|
||||
${pkgs.emptyDirectory}
|
||||
$(dirname "${containerinitsh}")
|
||||
else
|
||||
echo "ComfyUI ROCm Docker image already exists, skipping build."
|
||||
fi
|
||||
|
||||
@@ -52,7 +52,6 @@ RUN mkdir -p \
|
||||
WORKDIR "$COMFYUI_PATH"
|
||||
EXPOSE 8188
|
||||
|
||||
CMD ["python", "main.py", \
|
||||
"--listen", "0.0.0.0", \
|
||||
"--port", "8188", \
|
||||
"--use-pytorch-cross-attention"]
|
||||
COPY init.sh /init.sh
|
||||
RUN chmod +x /init.sh
|
||||
ENTRYPOINT ["/init.sh"]
|
||||
Reference in new issue
Block a user