Skip to content

Commit 63c74d9

Browse files
Created a Docker Image for ComfyUI
Created a Docker image for running ComfyUI. The image includes ComfyUI and ComfyUI Manager. The image is based on the latest version of the PyTorch image.
0 parents  commit 63c74d9

File tree

6 files changed

+233
-0
lines changed

6 files changed

+233
-0
lines changed

.cspell.json

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
// Version of the settings file, this should always be 0.2
3+
"version": "0.2",
4+
5+
// The code in this repository is checked against British English, American English, and German
6+
"language": "en-gb,en-us,de-de",
7+
8+
// A list of file types that should be enabled (not all file types are enabled by default)
9+
"enableFiletypes": [
10+
"dockerfile",
11+
"gitignore",
12+
"nginx"
13+
],
14+
15+
// A list of paths that are ignored when spell-checking (ignores the .git directory, but excludes the commit message file that is created by Git
16+
// during a commit, and the cSpell configuration file itself)
17+
"ignorePaths": [
18+
".git",
19+
"!.git/COMMIT_EDITMSG",
20+
"**/.cspell.json",
21+
"source/PersonalWebsite/Assets/libraries/**/*"
22+
],
23+
24+
// A list of dictionaries that should be added beyond the American English dictionary
25+
"dictionaries": [
26+
27+
// Dictionaries that contain common misspellings
28+
"en-common-misspellings",
29+
"en-us-common-misspellings",
30+
"en-us",
31+
32+
// Dictionaries that contain the keywords of the programming, markup, styling, and configuration languages used in the project
33+
"docker",
34+
35+
// Other dictionaries, that contain the names of well-known companies, common acronyms related to computing, words used in data science,
36+
// common file extensions, common font names that may be used in CSS, common words often encountered in full-stack development, the
37+
// popular blind text Lorem Ipsum often used for testing text layout, terms common in computer networking, the most popular NPM packages that
38+
// may be used in Angular projects, terms used in popular public licenses, common software terms, and miscellaneous terms that are common in
39+
// software projects
40+
"companies",
41+
"computing-acronyms",
42+
"data-science",
43+
"filetypes",
44+
"fonts",
45+
"fullstack",
46+
"lorem-ipsum",
47+
"misc",
48+
"networking-terms",
49+
"npm",
50+
"public-licenses",
51+
"software-terms",
52+
"web-services"
53+
],
54+
55+
// A list of words to be always considered incorrect (by default, only words that have 4 or more characters are spell-checked, so this list
56+
// includes some common typos of words that are too short to be recognizes by CSpell)
57+
"flagWords": [
58+
"fo",
59+
"ot",
60+
"fro",
61+
"teh",
62+
"hte"
63+
],
64+
65+
// A list of words that are not in the included default dictionary for British English, American English, or German
66+
"words": [
67+
"comfyui",
68+
"cudnn",
69+
"lecode",
70+
"vsicons"
71+
]
72+
}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
# Operating system-specific icon/file preview databases
3+
.DS_Store
4+
Thumbs.db

.vscode/settings.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
// A vertical ruler in the code editor at 150 characters, this is a visual aide to help users keep the 150 character line limit file files that
3+
// warrant a line limit
4+
"editor.rulers": [150],
5+
6+
// Inserts a final new line at the end of a file and trims trailing white spaces from all lines in the code editor when saving
7+
"files.insertFinalNewline": true,
8+
"files.trimTrailingWhitespace": true,
9+
10+
// A list of files that are not displayed in the file explorer of Visual Studio Code
11+
"files.exclude": {
12+
"**/.DS_Store": true,
13+
"**/.git": true,
14+
"**/bin": true,
15+
"**/obj": true,
16+
"**/Thumbs.db": true
17+
},
18+
19+
// Specifies which Git branches are protected in this repository, Visual Studio Code will prevent users from committing to these branches (this
20+
// only works for the commit feature that is built into Visual Studio Code and not in the terminal)
21+
"git.branchProtection": [
22+
"main",
23+
"develop"
24+
],
25+
26+
// Specifies that Visual Studio Code should always open the merge editor when a file is opened that has conflicts, instead of the code editor
27+
"git.mergeEditor": true,
28+
29+
// Allows users to force push to a remote Git repository, as we regularly make use of "git commit --amend" in this project
30+
"git.allowForcePush": true,
31+
32+
// Tells Visual Studio Code to fetch all branches instead of only the current one when pulling from a remote repository and to prune references
33+
// to remote objects that no longer exist
34+
"git.fetchOnPull": true,
35+
"git.pruneOnFetch": true,
36+
37+
// Specifies that Visual Studio Code should push tags and perform a rebase instead of a merge when synching with a remote repository
38+
"git.followTagsWhenSync": true,
39+
"git.rebaseWhenSync": true,
40+
41+
// Imports the external settings for the code spell checker CSPell, furthermore, the "ignorePaths" and the "useGitignore" settings are reset,
42+
// because they overwrite the settings in the imported configuration, also the diagnostic level is increased from "Information" to "Error" to
43+
// indicate that spelling mistakes must be corrected
44+
"cSpell.ignorePaths": [],
45+
"cSpell.useGitignore": false,
46+
"cSpell.diagnosticLevel": "Error",
47+
"cSpell.import": [".cspell.json"],
48+
49+
// Configures the icon theme to be VSCode Icons and adapts the icons of certain files and directories for the VSCode Icons plugin
50+
"workbench.iconTheme": "vscode-icons",
51+
"vsicons.associations.files": [
52+
{"icon": "vscode", "extensions": [".vscode/extensions.json", ".vscode/settings.json"], "filename": true, "format": "svg"}
53+
],
54+
"vsicons.associations.folders": []
55+
}

Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
# This image is based on the latest official PyTorch image, because it already contains CUDA, CuDNN, and PyTorch
3+
FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime
4+
5+
# Adds some metadata to the resulting Docker image via labels, the label names are standardized by the Open Container Initiative (OCI) in their Image
6+
# Specification Annotation
7+
LABEL org.opencontainers.image.authors="David Neumann <david.neumann@lecode.de>"
8+
LABEL org.opencontainers.image.url="https://github.com/lecode-official/comfyui-docker"
9+
LABEL org.opencontainers.image.documentation="https://github.com/lecode-official/comfyui-docker/tree/main/docs"
10+
LABEL org.opencontainers.image.source="https://github.com/lecode-official/comfyui-docker/tree/main"
11+
LABEL org.opencontainers.image.version="0.1.0"
12+
LABEL org.opencontainers.image.vendor="David Neumann"
13+
LABEL org.opencontainers.image.licenses="MIT"
14+
LABEL org.opencontainers.image.title="ComfyUI Docker"
15+
LABEL org.opencontainers.image.description="A Docker image running ComfyUI."
16+
17+
# Installs Git, because ComfyUI and the ComfyUI Manager are installed by cloning their respective Git repositories
18+
RUN apt update --assume-yes && \
19+
apt install --assume-yes git
20+
21+
# Clones the ComfyUI repository and checks out the latest release
22+
RUN git clone https://github.com/comfyanonymous/ComfyUI.git /opt/comfyui && \
23+
cd /opt/comfyui && \
24+
git checkout tags/v0.3.4
25+
26+
# Sets the working directory to the ComfyUI directory
27+
WORKDIR /opt/comfyui
28+
29+
# Installs the required Python packages
30+
RUN pip install -r requirements.txt
31+
32+
# Installs the ComfyUI Manager, which is an extension for ComfyUI that makes it possible to install, remove, disable, and enable various custom nodes
33+
RUN git clone https://github.com/ltdrdata/ComfyUI-Manager.git custom_nodes/ComfyUI-Manager
34+
35+
# Exposes the default port of ComfyUI (this is not actually exposing the port to the host machine, but it is good practice to include it as metadata,
36+
# so that the user knows which port to publish)
37+
EXPOSE 8188
38+
39+
# On startup, ComfyUI is started at its default port; the IP address is changed from localhost to 0.0.0.0, because Docker is only forwarding traffic
40+
# to the IP address it assigns to the container, which is unknown at build time; listening to 0.0.0.0 means that ComfyUI listens to all incoming
41+
# traffic; the auto-launch feature is disabled, because we do not want (nor is it possible) to open a browser window in a Docker container
42+
CMD ["python", "main.py", "--listen", "0.0.0.0", "--port", "8188", "--disable-auto-launch"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 David Neumann
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# ComfyUI Docker
2+
3+
This is a Docker image for [ComfyUI](https://www.comfy.org/), which makes it extremely easy to run ComfyUI on Linux and Windows WSL2. The image also includes the [ComfyUI Manager](https://github.com/ltdrdata/ComfyUI-Managergithub ) extension.
4+
5+
## Getting Started
6+
7+
To get started, you have to install [Docker](https://www.docker.com/). This can be either Docker Engine, which can be installed by following the [Docker Engine Installation Manual](https://docs.docker.com/engine/install/) or Docker Desktop, which can be installed by [downloading the installer](https://www.docker.com/products/docker-desktop/) for your operating system.
8+
9+
To enable the usage of NVIDIA GPUs, the NVIDIA Container Toolkit must be installed. The installation process is detailed in the [official documentation](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)
10+
11+
## Building
12+
13+
The image can be build using the following command:
14+
15+
```sh
16+
docker build --tag lecode/comfyui-docker:latest .
17+
```
18+
19+
## Running
20+
21+
The built image can be run like so:
22+
23+
```sh
24+
docker run \
25+
--name comfyui \
26+
--detach \
27+
--restart unless-stopped \
28+
--volume <path/to/models/folder>:/opt/comfyui/models \
29+
--publish 8188:8188 \
30+
--runtime=nvidia \
31+
--gpus all \
32+
lecode/comfyui-docker:latest
33+
```
34+
35+
Please note, that the `<path/to/models/folder>` must be replaced with a path to a folder on the host system where the models will be stored, e.g., `$HOME/.comfyui`.
36+
37+
## License
38+
39+
The ComfyUI Docker image is licensed under the [MIT License](LICENSE). [ComfyUI](https://github.com/comfyanonymous/ComfyUI/blob/master/LICENSE) and the [ComfyUI Manager](https://github.com/ltdrdata/ComfyUI-Manager/blob/main/LICENSE.txt) are both licensed under the GPL 3.0 license.

0 commit comments

Comments
 (0)