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.
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 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 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.
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.
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.
I updated the paths to make all paths work
Now paths in ComfyUI are working
Added:
- `input`
- `models/configs`
- `models/gligen`
- `models/diffusers`
- `models/hypernetworks`
Was broken:
- `custom_nodes`
- `models/clip_vision`
- `models/clip`
---------
Co-authored-by: LEv145 <you@example.com>
Co-authored-by: AbdBarho <ka70911@gmail.com>
As discussed in Discussion
[#367](https://github.com/AbdBarho/stable-diffusion-webui-docker/discussions/367),
this adds support for the newer ComfyUI. I forked the fork that would
already add this but the maintainer of that fork hasn't implemented the
changes needed to properly get the output function working, which I did.
I believe everything is functional though I have not tested every single
node.
I changed the table format for the README and a few other minor things
for aesthetic reasons but if you want me to revert those, I will.
---------
Co-authored-by: Jonathan Kovacs <jkovacs-dev@users.noreply.github.com>
Co-authored-by: AbdBarho <ka70911@gmail.com>