Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New ComfyUI Dockerfile features #739

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

lainedfles
Copy link

@lainedfles lainedfles commented Sep 29, 2024

Dockerfile overhaul

Enhance the Dockerfile for the ComfyUI service by introducing several new features and configurations. The ARGs provide flexibility in configuring the Docker container, allowing users to tailor the ComfyUI installation to their specific needs. Here's a detailed breakdown of the changes:

  1. Base Image Update:

    • Updated the base image from pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime to pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime. This ensures compatibility with newer versions of PyTorch and CUDA, providing better performance and support for recent hardware.
  2. Environment Variables:

    • Introduced several new environment variables (USE_UID, USE_GID, USE_USER, USE_GROUP) to allow customization of the user and group IDs within the container.
    • Added flags (USE_EDGE, USE_GGUF, USE_XFLUX, USE_CNAUX, USE_KRITA, USE_IPAPLUS, USE_INPAINT, USE_TOOLING) to enable or disable optional features and integrations.
  3. User/Group Management:

    • Added logic to create a user and group with specified IDs (USE_UID and USE_GID). This is useful for running the container in environments where specific user permissions are required.
    • Set default values for these variables, ensuring that the Dockerfile remains functional without explicit configuration.
  4. Optional Feature Integration:

    • Included conditional logic to clone and install additional repositories based on the flags set (USE_GGUF, USE_XFLUX, USE_CNAUX, USE_KRITA, USE_IPAPLUS, USE_INPAINT, USE_TOOLING). This allows users to customize their ComfyUI installation by enabling only the features they need.
    • Ensured that dependencies for these optional features are installed correctly, including handling specific cases like separating ONNX Runtime installations to restore CUDA support.
  5. Python Version Update:

    • Changed the Python command from python to python3 in the CMD instruction to explicitly specify the use of Python 3, which is a best practice for clarity and compatibility.
  6. File Permissions and Ownership:

    • Used --chown=${USE_UID}:${USE_GID} when copying files into the container to ensure that the correct user owns these files, preventing permission issues during execution.
  7. General Improvements:

    • Improved readability and maintainability of the Dockerfile by organizing the steps logically and adding comments where necessary.
    • Ensured that all commands are idempotent, meaning they can be run multiple times without causing unintended side effects.
  • USE_UID: Specifies the user ID for the non-root user within the container. Default is set to value 0.
  • USE_GID: Specifies the group ID for the non-root user within the container. Default is set to value like 0.
  • USE_USER: Specifies the username for the non-root user within the container. Default is set to root.
  • USE_GROUP: Specifies the group name for the non-root user within the container. Default is set to root.
  • USE_EDGE: If set to true, clones and installs the latest development version of ComfyUI from the main branch.
  • USE_GGUF: If set to true, clones and installs the ComfyUI-GGUF extension for GPU acceleration.
  • USE_XFLUX: If set to true, clones and installs the x-flux-comfyui extension for additional functionalities.
  • USE_CNAUX: If set to true, clones and installs the comfyui_controlnet_aux extension for control net auxiliary features.
  • USE_KRITA: If set to true, clones and installs multiple extensions (comfyui_controlnet_aux, ComfyUI_IPAdapter_plus, comfyui-inpaint-nodes, comfyui-tooling-nodes) that are useful when integrating with Krita.
  • USE_IPAPLUS: If set to true, clones and installs the ComfyUI_IPAdapter_plus extension for IP Adapter functionalities.
  • USE_INPAINT: If set to true, clones and installs the comfyui-inpaint-nodes extension for inpainting capabilities.
  • USE_TOOLING: If set to true, clones and installs the comfyui-tooling-nodes extension for additional tooling features.

New entrypoint.sh features

Introduce several enhancements to the entrypoint.sh script for the Comfy service. These changes enhance the script's flexibility, making it easier to integrate additional features and manage dependencies dynamically based on environment configurations:

  1. Custom Node Update: Added logic to update custom nodes located in /data/config/comfy/custom_nodes/. If the UPDATE_CUSTOM_NODES environment variable is set to true, it will pull the latest changes from each node's Git repository.

  2. Environment Variable Usage: Introduced a new environment variable CACHE which should be used instead of hard-coding /root/.cache. This makes the script more flexible and configurable.

  3. Krita Integration: Added support for Krita integration with ComfyUI, including downloading models if KRITA_DOWNLOAD_MODELS is set to true, managing upscale models, and setting up symbolic links for model directories.

  4. GGUF, XFLUX, CNAUX, IPAPLUS, INPAINT, TOOLING Support: Included logic to handle additional custom nodes (ComfyUI-GGUF, x-flux-comfyui, comfyui_controlnet_aux, ComfyUI_IPAdapter_plus, comfyui-inpaint-nodes, comfyui-tooling-nodes) based on their respective environment variables (USE_GGUF, USE_XFLUX, USE_CNAUX, USE_IPAPLUS, USE_INPAINT, USE_TOOLING). These nodes are copied to the custom nodes directory if they don't already exist.

.env support

Add .env file support to docker-compose file for environment variable management across all defined services in the docker-compose.yml. By adding env_file: .env, each service will now load environment variables from a local .env file, enhancing configuration flexibility and security. This change ensures that sensitive information or common settings can be centralized and easily managed without hard-coding them into the Docker Compose file.

Examples

Podman

Build and run container with one line enabling bleeding edge ComfyUi, enable GGUF, XFLUX, and KRITA support (download recommended models):

podman-compose --podman-build-args='--build-arg="USE_EDGE=true" --build-arg="USE_GGUF=true" --build-arg="USE_XFLUX=true" --build-arg="USE_KRITA=true"' --podman-run-args='-e KRITA_DOWNLOAD_MODELS=true --gpus all' --profile comfy up

Build a container suitable for use with a systemd service to run as non-root:

podman-compose --verbose --podman-build-args='--build-arg="USE_UID=991" --build-arg="USE_GID=991" --build-arg="USE_USER=app" --build-arg="USE_GROUP=app" --build-arg="USE_EDGE=true" --build-arg="USE_GGUF=true" --build-arg="USE_XFLUX=true" --build-arg="USE_KRITA=true"' --profile comfy build

Docker

Build to enable Krita support:

docker compose --profile comfy-cpu build --build-arg USE_KRITA=true

Use .env file to enable node updates and download recomended Krita models:

cat <<EOF> .env
UPDATE_CUSTOM_NODES=true
KRITA_DOWNLOAD_MODELS=true
EOF

Run container:

docker compose --profile comfy-cpu up

Closes issue #728

Edit: major refactor

Disclaimer: no code is AI generated (just old-fashioned human AGI) but various local LLMs were used to author commit messages.

@SummitCollie
Copy link

SummitCollie commented Nov 16, 2024

Sorry to post asking for help here, but I can't get this to run due to some issue with your UID/GID changes. Any idea what's going on here? Do I have to configure my host system in a particular way?

# ...
 => [comfy stage-0  9/10] COPY --chown=131:131 . /docker/                                                          0.1s 
 => [comfy stage-0 10/10] RUN chmod u+x /docker/entrypoint.sh && cp /docker/extra_model_paths.yaml /stable-diffus  0.2s 
 => [comfy] exporting to image                                                                                     3.0s 
 => => exporting layers                                                                                            3.0s 
 => => writing image sha256:ec115f42b580bc2ea9cb9c50466b17760444bf5d64198279d31ac9766f7f5992                       0.0s 
 => => naming to docker.io/library/sd-comfy:7                                                                      0.0s
 => [comfy] resolving provenance for metadata file                                                                 0.0s
[+] Running 1/1
 ✔ Container webui-docker-comfy-1  Recreated                                                                       0.1s 
Attaching to comfy-1
comfy-1  | Mounted comfy
comfy-1  | Mounted input
comfy-1  | Mounted .cache
comfy-1  | created directory '/stable-diffusion/models/upscale_models.stock'
comfy-1  | copied '/stable-diffusion/models/upscale_models/put_esrgan_and_other_upscale_models_here' -> '/stable-diffusion/models/upscale_models.stock/put_esrgan_and_other_upscale_models_here'
comfy-1  | removed '/stable-diffusion/models/upscale_models/put_esrgan_and_other_upscale_models_here'
comfy-1  | removed directory '/stable-diffusion/models/upscale_models'
comfy-1  | mv: cannot create directory '/data/config/comfy/custom_nodes/comfyui_controlnet_aux': Permission denied
comfy-1 exited with code 1

ComfyUI and A1111 run fine using the base repo FWIW.

@lainedfles
Copy link
Author

lainedfles commented Nov 16, 2024

@SummitCollie

Sorry to post asking for help here, but I can't get this to run due to some issue with your UID/GID changes. Any idea what's going on here? Do I have to configure my host system in a particular way?

Hi, this seems to be a great place for such issues. Testing is helpful. Based on your comment:

ComfyUI and A1111 run fine using the base repo FWIW.

I presume that your volumes have been created using the base repo default of UID/GID 0:0 or the root user. This is expected behavior since the UID has changed. The most "secure" option is to change the ownership of the existing files. I ran a command like this (only a single execution should be required):

podman run --rm -u root -v sd-comfy-data:/data -v sd-comfy-output:/output -it localhost/sd-comfy:7 bash -c 'chown -R app:app /data /output'

Perhaps something like:

docker run --rm -u root -v <data volume name or path>:/data -v <output volume name or path>:/output -it localhost/sd-comfy:7 bash -c 'chown -R app:app /data /output'

Alternatively, you could re-build the image to use the root UID by passing build arguments: USE_UID=0 & USE_GID=0.

While I'd explicitly avoided adding an automatic scripted action to enforce the recursive directory ownership, perhaps we can re-consider it if enough users require it.

@SummitCollie
Copy link

@lainedfles thanks for the quick response! As you can tell, I don't know what I'm doing with Docker, but I think I see what was going on. This is the command that worked for me (no "actual" docker volumes, just directories on host):

docker run --rm -u root -v ./data:/data -v ./output:/output -it sd-comfy:7 bash -c 'chown -R app:app /data /output'

It's running and generating images now, but I do get this CNAUX error upon server startup:

 ✔ Container webui-docker-comfy-1  Created                                                                         0.0s 
Attaching to comfy-1
comfy-1  | Mounted comfy
comfy-1  | Mounted input
comfy-1  | Mounted .cache
comfy-1  | Total VRAM 24086 MB, total RAM 63878 MB
comfy-1  | pytorch version: 2.3.1
comfy-1  | Set vram state to: NORMAL_VRAM
comfy-1  | Device: cuda:0 NVIDIA GeForce RTX 4090 : cudaMallocAsync
comfy-1  | Using pytorch cross attention
comfy-1  | ****** User settings have been changed to be stored on the server instead of browser storage. ******
comfy-1  | ****** For multi-user setups add the --multi-user CLI argument to enable multiple user profiles. ******
comfy-1  | [Prompt Server] web root: /stable-diffusion/web
comfy-1  | Adding extra search path checkpoints /data/models/Stable-diffusion
comfy-1  | Adding extra search path configs /data/models/Stable-diffusion
comfy-1  | Adding extra search path vae /data/models/VAE
comfy-1  | Adding extra search path loras /data/models/Lora
comfy-1  | Adding extra search path upscale_models /data/models/RealESRGAN
comfy-1  | Adding extra search path upscale_models /data/models/ESRGAN
comfy-1  | Adding extra search path upscale_models /data/models/SwinIR
comfy-1  | Adding extra search path upscale_models /data/models/GFPGAN
comfy-1  | Adding extra search path hypernetworks /data/models/hypernetworks
comfy-1  | Adding extra search path controlnet /data/models/ControlNet
comfy-1  | Adding extra search path gligen /data/models/GLIGEN
comfy-1  | Adding extra search path clip /data/models/CLIPEncoder
comfy-1  | Adding extra search path embeddings /data/embeddings
comfy-1  | Adding extra search path unet /data/models/unet
comfy-1  | Adding extra search path clip_vision /data/models/clip_vision
comfy-1  | Adding extra search path xlabs /data/models/xlabs
comfy-1  | Adding extra search path inpaint /data/models/inpaint
comfy-1  | Adding extra search path ipadapter /data/models/ipadapter
comfy-1  | Adding extra search path custom_nodes /data/config/comfy/custom_nodes
comfy-1  | Traceback (most recent call last):
comfy-1  |   File "/stable-diffusion/nodes.py", line 2012, in load_custom_node
comfy-1  |     module_spec.loader.exec_module(module)
comfy-1  |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
comfy-1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
comfy-1  |   File "/data/config/comfy/custom_nodes/comfyui_controlnet_aux/__init__.py", line 2, in <module>
comfy-1  |     from .utils import here, define_preprocessor_inputs, INPUT
comfy-1  |   File "/data/config/comfy/custom_nodes/comfyui_controlnet_aux/utils.py", line 4, in <module>
comfy-1  |     import cv2
comfy-1  |   File "/home/app/.local/lib/python3.10/site-packages/cv2/__init__.py", line 181, in <module>
comfy-1  |     bootstrap()
comfy-1  |   File "/home/app/.local/lib/python3.10/site-packages/cv2/__init__.py", line 153, in bootstrap
comfy-1  |     native_module = importlib.import_module("cv2")
comfy-1  |   File "/opt/conda/lib/python3.10/importlib/__init__.py", line 126, in import_module
comfy-1  |     return _bootstrap._gcd_import(name[level:], package, level)
comfy-1  | ImportError: libGL.so.1: cannot open shared object file: No such file or directory
comfy-1  | 
comfy-1  | Cannot import /data/config/comfy/custom_nodes/comfyui_controlnet_aux module for custom nodes: libGL.so.1: cannot open shared object file: No such file or directory
comfy-1  | 
comfy-1  | Import times for custom nodes:
comfy-1  |    0.0 seconds (IMPORT FAILED): /data/config/comfy/custom_nodes/comfyui_controlnet_aux
comfy-1  |    0.0 seconds: /stable-diffusion/custom_nodes/websocket_image_save.py
comfy-1  |    0.0 seconds: /data/config/comfy/custom_nodes/comfyui-inpaint-nodes
comfy-1  |    0.0 seconds: /data/config/comfy/custom_nodes/ComfyUI_IPAdapter_plus
comfy-1  |    0.1 seconds: /data/config/comfy/custom_nodes/comfyui-tooling-nodes
comfy-1  | 
comfy-1  | Starting server
comfy-1  | 
comfy-1  | To see the GUI go to: http://0.0.0.0:7860
comfy-1  | To see the GUI go to: http://[::]:7860

Here's my config, which I specified directly in the Dockerfile (hope that's not terribly bad practice). Intended use is with Krita + some SDXL checkpoints:

ARG USE_UID=131
ARG USE_GID=131
ARG USE_EDGE=false
ARG USE_GGUF=false
ARG USE_XFLUX=false
ARG USE_CNAUX=true
ARG USE_KRITA=true
ARG USE_IPAPLUS=true
ARG USE_INPAINT=true
ARG USE_TOOLING=true

@lainedfles
Copy link
Author

lainedfles commented Nov 16, 2024

@lainedfles thanks for the quick response!

Edit: this contains good troubleshooting information so I'll leave it but I think I've identified the issue. I'll add a new commit to the PR soon.

@SummitCollie No prob! I've been playing around with Aider.

comfy-1 | Cannot import /data/config/comfy/custom_nodes/comfyui_controlnet_aux module for custom nodes: libGL.so.1: cannot open shared object file: No such file or directory

This is strange. Have you made any modifications aside from env arg defaults? I'd guess a few possible causes:

  • Corrupt image, you might try re-building the image with --no-cache
  • FROM image set to source without libGL support
  • Incorrect LD_LIBRARY_PATH

On my system, /usr/lib/x86_64-linux-gnu/libGL.so.1 is a symbolic link to libGL.so.1.7.0. I'd suggest the following to gain more information:

$ docker exec -it comfy-1 bash -c 'find / -iname libGL.so.1'
$ docker exec -it comfy-1 bash -c 'ls -lh /usr/lib/x86_64-linux-gnu/libGL.so.1'

Here's my config, which I specified directly in the Dockerfile (hope that's not terribly bad practice). Intended use is with Krita + some SDXL checkpoints:

You do you! It looks OK to me but FYI, enabling the single variable USE_KRITA automatically enables USE_CNAUX, USE_IPAPLUS, USE_INPAINT, and USE_TOOLING.

@SummitCollie
Copy link

SummitCollie commented Nov 16, 2024

@lainedfles Ah that was my mistake, I ended up solving it about 1 minute before you responded 😿

I had commented out the second part of this line because the USE_XFLUX thing was preventing build from succeeding (with no useful error). I had inadvertently also commented out the part that installs libgl1-mesa-glx which was the source of my problem.

Ultimately I removed the USE_XFLUX check like below and now it's all working correctly. Thanks for all your help and your work on this PR! I hope it can get merged someday if the base project is un-abandoned!

-RUN apt-get update && apt-get install -y git && ([ "${USE_XFLUX}" = "true" ] && apt-get install -y libgl1-mesa-glx python3-opencv) && apt-get clean
+RUN apt-get update && apt-get install -y git libgl1-mesa-glx python3-opencv && apt-get clean

@lainedfles
Copy link
Author

@SummitCollie good work. I think that the new commit should provide a fix. Just tested Flux.1 Schnell (Have you tried the Flux.1 models? They're incredible!). Here's the result, cheers!

image

@SummitCollie
Copy link

SummitCollie commented Nov 16, 2024

@lainedfles Thanks again! Also btw, KRITA_DOWNLOAD_MODELS didn't work until I changed the script path to remove duplicate scripts/scripts/:

-  if [ "${KRITA_DOWNLOAD_MODELS:-false}" = "true" ]; then
-    cd "${ROOT}/krita-ai-diffusion/scripts" && python scripts/download_models.py --recommended /data && cd ..
+  if [ "${KRITA_DOWNLOAD_MODELS:-true}" = "true" ]; then
+    cd "${ROOT}/krita-ai-diffusion/scripts" && python download_models.py --recommended /data && cd ..

I also changed the default from false to true because I couldn't figure out how to supply build args using docker compose syntax (I am a noob and the example uses podman so... yeah)

@lainedfles
Copy link
Author

@SummitCollie Good catch! Thanks for the help testing this. I'll add a new commit tomorrow to fix that (unless you want to submit a PR to my branch). I'll also fire up my dusty Ubuntu VM tomorrow and try building this with docker compose. I suspect that you may be able to set the environment variables prepended to the command, something like USE_KRITA=true KRITA_DOWNLOAD_MODELS=true docker compose --profile comfyui up --build or possibly docker compose --profile comfyui build --build-arg USE_KRITA=true --build-arg KRITA_DOWNLOAD_MODELS=true

This commit introduces the use of an `.env` file for environment variable management across all defined services in the `docker-compose.yml`. By adding `env_file: .env`, each service will now load environment variables from a local `.env` file, enhancing configuration flexibility and security. This change ensures that sensitive information or common settings can be centralized and easily managed without hardcoding them into the Docker Compose file.
This commit introduces a new `.env` file for environment variable management and updates the `.gitignore` file to ensure that this sensitive configuration file is not tracked by version control. This change helps maintain security by preventing accidental exposure of environment-specific settings in the repository.
This commit introduces several new model paths to the `extra_model_paths.yaml` file under the `a111` section. The added paths include `unet`, `clip_vision`, `xlabs`, `inpaint`, and `ipadapter`. These additions enhance the configuration by providing more options for different models, which can be utilized in various functionalities within the service.
… in entrypoint.sh

This commit introduces several enhancements to the `entrypoint.sh` script for the Comfy service:

1. **Custom Node Management**: Added logic to update custom nodes located in `/data/config/comfy/custom_nodes/`. If the `UPDATE_CUSTOM_NODES` environment variable is set to `true`, it will pull the latest changes from each node's Git repository and update submodules recursively for specific nodes like `krita-ai-diffusion`.

2. **Environment Variable Usage**: Introduced a new environment variable `CACHE` which should be used instead of hardcoding `/root/.cache`. This makes the script more flexible and configurable.

3. **Krita Integration**: Added support for Krita integration with ComfyUI, including downloading models if `KRITA_DOWNLOAD_MODELS` is set to `true`, managing upscale models, and setting up symbolic links for model directories.

4. **GGUF, XFLUX, CNAUX, IPAPLUS, INPAINT, TOOLING Support**: Included logic to handle additional custom nodes (`ComfyUI-GGUF`, `x-flux-comfyui`, `comfyui_controlnet_aux`, `ComfyUI_IPAdapter_plus`, `comfyui-inpaint-nodes`, `comfyui-tooling-nodes`) based on their respective environment variables (`USE_GGUF`, `USE_XFLUX`, `USE_CNAUX`, `USE_IPAPLUS`, `USE_INPAINT`, `USE_TOOLING`). These nodes are moved to the custom nodes directory if they don't already exist.

5. **Model Management**: Added functionality to download and manage specific models required by certain integrations, such as CLIP Vision and IP Adapters for XFLUX.

These changes enhance the script's flexibility, making it easier to integrate additional features and manage dependencies dynamically based on environment configurations.
…rations

This commit significantly enhances the `Dockerfile` for the ComfyUI service by introducing several new features and configurations. Here's a detailed breakdown of the changes:

1. **Base Image Update**:
   - Updated the base image from `pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime` to `pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime`. This ensures compatibility with newer versions of PyTorch and CUDA, providing better performance and support for recent hardware.

2. **Environment Variables**:
   - Introduced several new environment variables (`USE_UID`, `USE_GID`, `USE_USER`, `USE_GROUP`) to allow customization of the user and group IDs within the container.
   - Added flags (`USE_EDGE`, `USE_GGUF`, `USE_XFLUX`, `USE_CNAUX`, `USE_KRITA`, `USE_IPAPLUS`, `USE_INPAINT`, `USE_TOOLING`) to enable or disable optional features and integrations.

3. **User/Group Management**:
   - Added logic to create a user and group with specified IDs (`USE_UID` and `USE_GID`). This is useful for running the container in environments where specific user permissions are required.
   - Set default values for these variables, ensuring that the Dockerfile remains functional without explicit configuration.

4. **Optional Feature Integration**:
   - Included conditional logic to clone and install additional repositories based on the flags set (`USE_GGUF`, `USE_XFLUX`, `USE_CNAUX`, `USE_KRITA`, `USE_IPAPLUS`, `USE_INPAINT`, `USE_TOOLING`). This allows users to customize their ComfyUI installation by enabling only the features they need.
   - Ensured that dependencies for these optional features are installed correctly, including handling specific cases like separating ONNX Runtime installations to restore CUDA support.

5. **Python Version Update**:
   - Changed the Python command from `python` to `python3` in the CMD instruction to explicitly specify the use of Python 3, which is a best practice for clarity and compatibility.

6. **File Permissions and Ownership**:
   - Used `--chown=${USE_UID}:${USE_GID}` when copying files into the container to ensure that the correct user owns these files, preventing permission issues during execution.

7. **General Improvements**:
   - Improved readability and maintainability of the Dockerfile by organizing the steps logically and adding comments where necessary.
   - Ensured that all commands are idempotent, meaning they can be run multiple times without causing unintended side effects.

- `USE_UID`: Specifies the user ID for the non-root user within the container. Default is set to value 0.
- `USE_GID`: Specifies the group ID for the non-root user within the container. Default is set to value like 0.
- `USE_USER`: Specifies the username for the non-root user within the container. Default is set to `root`.
- `USE_GROUP`: Specifies the group name for the non-root user within the container. Default is set to `root`.
- `USE_EDGE`: If set to `true`, clones and installs the latest development version of ComfyUI from the main branch.
- `USE_GGUF`: If set to `true`, clones and installs the ComfyUI-GGUF extension for GPU acceleration.
- `USE_XFLUX`: If set to `true`, clones and installs the x-flux-comfyui extension for additional functionalities.
- `USE_CNAUX`: If set to `true`, clones and installs the comfyui_controlnet_aux extension for control net auxiliary features.
- `USE_KRITA`: If set to `true`, clones and installs multiple extensions (comfyui_controlnet_aux, ComfyUI_IPAdapter_plus, comfyui-inpaint-nodes, comfyui-tooling-nodes) that are useful when integrating with Krita.
- `USE_IPAPLUS`: If set to `true`, clones and installs the ComfyUI_IPAdapter_plus extension for IP Adapter functionalities.
- `USE_INPAINT`: If set to `true`, clones and installs the comfyui-inpaint-nodes extension for inpainting capabilities.
- `USE_TOOLING`: If set to `true`, clones and installs the comfyui-tooling-nodes extension for additional tooling features.

These ARGs provide flexibility in configuring the Docker container, allowing users to tailor the ComfyUI installation to their specific needs.
@lainedfles lainedfles force-pushed the non-root-new-features branch from aa03ba0 to 1ba0fa8 Compare November 25, 2024 01:41
…int.sh

This commit addresses an issue where the script did not change back to the original directory after creating a symbolic link. By adding `&& cd ..` at the end of the `ln -sfT /data/models/upscale_models upscale_models` command, we ensure that the working directory remains consistent and expected for subsequent operations in the script. This fix prevents potential errors or unexpected behavior due to an incorrect current working directory.
This commit refactors the `entrypoint.sh` script to enhance error handling and ensure consistent use of quotes around variables. Specifically:

1. **Error Handling**: Added `set +e` before `git pull` commands within the loop for updating custom nodes, allowing the script to continue processing other nodes even if one fails. This is followed by `set -e` to revert to strict error handling.

2. **Consistent Quoting**: Ensured that all variables are quoted consistently throughout the script to prevent issues with spaces or special characters in file paths.

3. **Command Placement**: Moved the model download command for Krita after checking and creating symbolic links, ensuring that models are downloaded into the correct directory structure.

4. **Use of `cp -a` Instead of `mv`**: Changed the use of `mv` to `cp -a` when copying custom nodes to preserve file attributes and avoid accidental deletion of source files.

These changes improve the robustness and reliability of the script, making it more resilient to errors and ensuring that all operations are performed correctly.
This commit fixes an issue in the `entrypoint.sh` script where the directory was not being changed back to its original location after running the model download script for Krita. The `cd ..` command has been replaced with `cd -`, which correctly returns to the previous working directory, ensuring that subsequent commands in the script are executed from the expected path. This change prevents potential errors and ensures the script behaves as intended.
@lainedfles
Copy link
Author

@SummitCollie I think this PR is ready. I've reverted the non-root default to better align with the presumed intent. Running as non-root now requires additional build arguments.

If you try this, I'd appreciate if you'd comment about your experience. 👍🏻

@coopbri
Copy link

coopbri commented Dec 2, 2024

@lainedfles Just wanted to say your changes are working great for me! Thank you so much for this effort!!

@lainedfles
Copy link
Author

@coopbri It's been a pleasure, thank you for the testing and feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants