JMDOTS ComfyUI
A simple container lifecycle management solution for ComfyUI using docker-compose
.
ComfyUI is a revolutionary node-based graphical user interface (GUI) designed to facilitate the use of Stable Diffusion, a powerful platform for generating AI-driven images. Unlike traditional text-based interfaces, ComfyUI uses a visual approach where users can create and manage complex workflows through interconnected nodes. This setup allows for greater flexibility, customization, and understanding of each step involved in the image generation process.
For more information, refer to the Beginner's Guide to ComfyUI and the Definitive Guide to ComfyUI.
- Support
make
managing the container lifecycle. - Provide a Dockerfile for NVIDIA GPUs based on the NVIDIA PyTorch image.
- Support ComfyUI Manager first-install as well as existing installations already present in a host directory.
- Support mounting a host directory containing models as a volume into the container.
- Note: This models directory won't be the one used by ComfyUI Manager.
- Provide a simple default
extra_model_paths.yaml
.- Note: This file will not address ComfyUI Manager's paths.
- Support mounting a host directory to
ComfyUI/custom_nodes
as a volume into the container.- Note: This enables persistence for ComfyUI Manager.
- Bind the container's port to the host's localhost for security.
- Support Docker CE container manager.
- Delegate to ComfyUI Manager all of the hard things like managing models, custom nodes, etc.
- Reach the point of zero warnings seen on container boot.
- Use
.env
to drive git-ignored configuration.
- Implement GitHub Actions CI for building images that push to Docker Hub.
- Provide a pre-built Docker image that supports NVIDIA GPUs.
- Support running ComfyUI across multiple NVIDIA GPUs present on the host.
- Support Podman container manager.
- Support
podman-compose
managing the container lifecycle. - Support AMD GPUs.
- Support Kubernetes managing the container lifecycle.
- Docker CE installed on your host machine.
- NVIDIA GPU drivers and NVIDIA Docker support if you plan to use NVIDIA GPUs.
-
Clone the repository:
git clone https://github.com/jmdots/jmdots-comfyui.git cd jmdots-comfyui
-
Create a
.env
file or copy the example:cp .env.example .env
-
Customize the
.env
file as needed:COMFYUI_IMAGE_NAME=jmdots/jmdots-comfyui COMFYUI_TAG=latest COMFYUI_CONTAINER_NAME=jmdots-comfyui COMFYUI_HOST_PORT=8188 COMFYUI_CONTAINER_PORT=8188 COMFYUI_VOLUME_MODELS=$(pwd)/var/ComfyUI/models COMFYUI_VOLUME_CUSTOM_NODES=$(pwd)/var/ComfyUI/custom_nodes COMFYUI_BIND_ADDRESS=127.0.0.1 COMFYUI_MANAGER_REPO=https://github.com/ltdrdata/ComfyUI-Manager.git COMFYUI_CUSTOM_NODES_DIR=var/ComfyUI/custom_nodes/ComfyUI-Manager
-
Build and start the Docker containers:
make rebuild
make build
: Build or rebuild container imagesmake up
: Create and start enabled containersmake down
: Stop and remove enabled containers, networksmake restart
: Restart enabled containersmake rebuild
: Rebuild container images and restart enabled containersmake stop
: Stop servicesmake logs
: Watch output from enabled containersmake nvidia
: Watch NVIDIA GPU usagemake ps
: List enabled containersmake rm
: Remove stopped service containersmake shell
: Get a shell prompt in the running containermake manager
: Clone or update ComfyUI-Manager
-
To check the logs of the running containers:
make logs
-
To access a shell in the running container:
make shell
-
To monitor NVIDIA GPU usage:
make nvidia
(optional)
Note: This feature is not related to ComfyUI Manage.
The repository includes a default extra_model_paths.example.yaml
file, which is copied into the container image as extra_model_paths.yaml
. Since this file needs customization for different use cases, follow these steps to set up your own configuration:
-
Copy the Example File:
cp extra_model_paths.example.yaml extra_model_paths.yaml
The
extra_model_paths.yaml
file is git-ignored to prevent it from being tracked by version control. -
Customize the File: Edit the
extra_model_paths.yaml
file according to your specific requirements. -
Mount the Customized File: To mount your customized
extra_model_paths.yaml
into the container, uncomment the line indocker-compose.yaml
for mounting./extra_models_paths.yaml
andmake restart
.
Note: You may find the Docker Compose override file pattern helpful if you use this feature.
This project has been successfully deployed and tested in the following contexts:
Operating System | CPU | GPU | Memory |
---|---|---|---|
Ubuntu 22.04.4 LTS (amd64) | AMD 7700X | NVIDIA RTX 4090 (24GB) | 128GB DDR5 |
Ubuntu 22.04.4 LTS (amd64) | Intel i9-14900HX | NVIDIA RTX 4090 (16GB) Mobile | 64GB DDR5 |
To contribute to this project, follow these steps:
- Fork the repository.
- Clone your fork:
git clone https://github.com/<your-username>/jmdots-comfyui.git cd jmdots-comfyui
- Create a new branch for your feature or bugfix:
git checkout -b my-feature-branch
- Make your changes and commit them:
git commit -m "Description of my changes"
- Push your changes to your fork:
git push origin my-feature-branch
- Open a pull request to the main repository.
Note: This feature is not yet active.
This project uses GitHub Actions for CI. The workflow is set up to build and push the Docker image to Docker Hub whenever a new tag is pushed.
To securely handle your Docker Hub credentials, add them as secrets in your GitHub repository settings:
- Go to your GitHub repository.
- Navigate to Settings > Secrets > New repository secret.
- Add two secrets:
DOCKER_USERNAME
: Your Docker Hub username.DOCKER_PASSWORD
: Your Docker Hub password.
Contributions are welcome! Please open an issue or submit a pull request with your improvements. Please ensure you understand the license sections below before contributing. Thank you!
This project includes components licensed under the GNU General Public License (GPL) version 3.0:
========================
jmdots-comfyui by JMDOTS
========================
Copyright © 2024 Joshua M. Dotson (contact@jmdots.com)
JMDOTS-DUAL-LICENSE-1.2
=======================
https://legal.jmdots.com/licenses/
Personal, Non-Commercial License
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This software is provided under the GNU Affero General Public License (AGPL)
version 3 or later. You are free to use, modify, and distribute this
software for personal, non-commercial use under the terms of the AGPL. If you
modify this software and distribute it, you must also make the modified
source code available under the same license terms. There is no warranty for
this software, to the extent permitted by applicable law.
For more details, please refer to the full text of the GNU AGPL: [GNU Affero
General Public License](http://www.gnu.org/licenses/)
Commercial License
~~~~~~~~~~~~~~~~~~
This software is available under a Commercial License for any business,
commercial, enterprise, or governmental use. The Commercial License allows
you to use, modify, and distribute this software in proprietary applications
without the requirement to disclose source code modifications or derivative
works. Under this license, you receive additional support and maintenance
services.
For information on purchasing a commercial license, please contact us at
[sales@jmdots.com](mailto:sales@jmdots.com) or visit our website at [JMDOTS
GitHub](http://www.github.com/jmdots/).
Limited Liability
~~~~~~~~~~~~~~~~~
In no event shall the authors or copyright holders be liable for any claim,
damages, or other liability arising from the use or distribution of this
software.