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.
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 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.
The invoke team already maintains a docker setup for their service, this
copy here was maybe relevant 2 years ago when all of this started, but I
don't think it makes sense anymore.
Refer to invoke's docs to install using docker
https://invoke-ai.github.io/InvokeAI/installation/040_INSTALL_DOCKER/
Fix the problem that some extensions need to be installed from src
Now, because the step of installing extensions is moved forward in
`entrypoint.sh` instead of `startup.sh`, we cannot install some required
packages before executing `install.py`
When installing the extension `sd-webui-roop`, it relies on
`insightface==0.7.3`, and when installing this pypi package, it is found
that when building the wheel package, an error will be reported because
`gcc` cannot be found
ddc02ee1a9/requirements.txt (L1)
Therefore, considering that not all pypi packages are distributed in
wheel, those pypi packages distributed in src need `build-essential` to
build
Perform a full extension installation process instead of just installing
dependencies
Some extensions do not include `requirements.txt` but install
dependencies in `install.py`, and all extensions include `install.py`,
so it is safe to use it for extended dependency installation
This is because the extension development of AUTOMATIC1111's webui does
not require the existence of `requirements.txt` but uses `install.py` to
initialize the extension
https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Developing-extensions#installpy
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>
`jq` merge direction in this case is right to left so if the user had
set up custom paths it would replace them with the default ones.
This PR switches the direction to use the defaults as fallback instead
of overwriting user settings.
----
Didn't want to create an issue for the tiny change.
Thanks for your work on the repo, it saved me a lot of time, 👍
---------
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>
## Justification
Closes issue #352
This update makes the Dockerfiles OCI compliant, making it easier to use
Buildah or other image building techniques that require it
## Implementation
This changes a few things, listed below:
* auto: Download container is switched to alpine. The `git` container
specified the `/git` directory as a volume. As such, all the files under
`/git` would be lost after each script invoke. Alpine is used later in
the build process anyway, so it shouldn't be any extra cost to switch to
it
* auto: "New" clone.sh script is copied into the container, which is
basically just the previous clone script that was embedded in the
Dockerfile.
* all: `<<EOF` heredoc styles have been switched to `&& \`
* all: I added NVIDIA_DRIVER_CAPABILITIES and NVIDIA_VISIBLE_DEVICES to
expose my Nvidia card. This is most likely a selinux/podman problem, but
shouldn't change anything with docker to add it.
* docker-compose: I added selinux labeling. I tested this with real
docker (not just podman!) and it seems to work fine. Though I suggest
you try it too.
## Testing
Locally builds with buildah.
Note: for caching to work properly, you still need to replace
`/root/.cache/pip` with `/root/.cache/pip,Z` on selinux systems.
Note: I was having some trouble running invoke. Thought it was this PR,
but it's a known issue. See
https://github.com/invoke-ai/InvokeAI/issues/3182
---------
Co-authored-by: AbdBarho <ka70911@gmail.com>
Upon enabling the ControlNet addon from
https://github.com/AbdBarho/stable-diffusion-webui-docker/pull/385 one
might want to use the `openpose` preprocessors. Those are downloaded by
the addon the first time they are used. Without proper mounts those
networks will be downloaded on usage after each container start.
This PR enables those mounts to reduce data traffic.
The ControlNet addon
[sd-webui-controlnet](https://github.com/Mikubill/sd-webui-controlnet)
requires the `data/ControlNet` folder to be mounted into
`models/ControlNet`.
This PR enables said mount and adds the ControlNet folder to
`.gitignore` file.
---------
Co-authored-by: AbdBarho <ka70911@gmail.com>
Rename the UIs in docker compose to their new names
Changes folder names
Changes output folder structure
Closes issue #263
Adds `sygil-sl` instead of docker compose flag.
- auto:
36a0ba357a
- History tab should be working, closes#138
- hlky:
bd57d22f2e
- experimental support for the streamlit UI, use the env var
`USE_STREAMLIT`, see the `docker-compose.yml` file, closes#105
- Don't create issues if it fails, it is still very early in dev.
### Update versions
- auto:
03d62538ae
- History Tab IS NOT WORKING YET! #138
- hlky:
fd51bab1ec
- lstein:
fe2a2cfc8bCloses#102 the config file has been moved to `data/config/auto`
1. Update `docker-compose.yml`: use `PRELOAD=true` for lstein. See the
[note](94bad8555a/docs/installation/INSTALL_LINUX.md (L60))
in the installation guide of InvokeAI.
3. Fix `services/lstein/mount.sh`: change `CodeFormer` to `Codeformer`.
4. Update `services/lstein/mount.sh`: avoid having to re-download the
`${PWD}/gfpgan/weights/...` every time the container is started.
- auto:
050a6a798c
- Now uses python 3.10
- requires a complete re-install
- Image is now smaller (5.7GB vs 9.8GB)
- hlky:
fe6e72fde7
- lstein:
31869885d9
- img2img now works
- auto:
2995107fa2
- More samplers
- Textual inversion training
- hlky:
1a9c053cb7
- Build times are SLOW
- lstein:
4f247a3672
- Prepare for 2.0 release
- very cool new UI!
### Update versions
- auto:
3f417566b0
### Breaking changes:
* renamed `automatic-1111` service to `auto`
* the `cache` folder is now deprecated, replaced with `data` (see
migration guide below)
* `embeddings` folder has been moved to `data/embeddings`
* use GFPGAN 1.4
### Migration Guide
Note: in theory, running the command
```
docker compose --profile download up --build
```
is all you need to use the new version, however, this means you will
also have to download everything again. A new script is available under
`scripts/migratev1tov2.sh` that will copy models to the new structure
and should get you most of the way, run
```bash
./scripts/migratev1tov2.sh
```
or you can manually inspect the script and copy the files
After that, run
```
docker compose --profile download up --build
```
to validate everything.
Docker compose allows override some settings in `docker-compose.yml` by
using additional file: `docker-compose.override.yml`.
This allows to hold own settings in override file which does not
conflict with updates made by pulling newer version with "git pull"
command.
This feature requires three things:
1. Creating `docker-compose.override.yml-dist` file which is a
distributed file inside repo. This file can be copied as
`docker-compose.override.yml` and modified for own needs.
2. Change in `.gitignore` file so `docker-compose.override.yml` file is
ignored, so git pull / commit will not complain about this file.
3. Modify wiki entry about setup to mention possibility to use this
method.
Closes#101
stale-issue-message:This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.
stale-pr-message:This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.
close-issue-message:This issue was closed because it has been stalled for 7 days with no activity.
close-pr-message:This PR was closed because it has been stalled for 7 days with no activity.
Run Stable Diffusion on your machine with a nice UI without any hassle!
This repository provides the [WebUI](https://github.com/hlky/stable-diffusion-webui) as docker for easy setup and deployment. Please note that this repo delivers all cutting-edge unstable changes from the WebUI, so expect some bugs.
## Setup
make sure you have docker installed and up to date. Download this repo and run:
```
docker compose build
```
you can let it build in the background while you download the different models
- [Stable Diffusion v1.4 (4GB)](https://drive.yerf.org/wl/?id=EBfTrmcCCUAGaQBXVIj5lJmEhjoP1tgl), rename to `model.ckpt`
- (Optional) [GFPGANv1.3.pth (333MB)](https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth) to improve generated faces.
- (Optional) [RealESRGAN_x4plus.pth (64MB)](https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth) and [RealESRGAN_x4plus_anime_6B.pth (18MB)](https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth) for super-sampling.
Put all of the downloaded models in the `models` folder, the folder structure should look something like this:
```
├── README.md
├── docker-compose.yml
├── build
├── cache
├── models
│ ├── GFPGANv1.3.pth
│ ├── RealESRGAN_x4plus.pth
│ ├── RealESRGAN_x4plus_anime_6B.pth
│ └── model.ckpt
├── output
```
## Run
After the build is done, you can run the app with:
```
docker compose up --build
```
Will start the app on http://localhost:7860/
Note: the first start will take sometime as some other models will be downloaded, these will be cached in the `cache` folder, so next runs are faster.
## Config
in the `docker-compose.yml` you can change the `CLI_ARGS` variable contains all of the variables that will be passed to [the web ui](https://github.com/hlky/stable-diffusion-webui/blob/49e6178fd82ca736f9bbc621c6b12487c300e493/webui.py), by default: `--extra-models-cpu --optimized-turbo` are given, which allow you to use this model on a 6GB GPU.
# Disclaimer
The authors of this project are not responsible for any content generated using this interface.
This license of this software forbids you from sharing any content that violates any laws, produce any harm to a person, disseminate any personal information that would be meant for harm, spread misinformation and target vulnerable groups. For the full list of restrictions please read [the license](./LICENSE).
# Thanks
Special thanks to everyone behind these awesome projects, without them, none of this would have been possible:
Run Stable Diffusion on your machine with a nice UI without any hassle!
## Setup & Usage
Visit the wiki for [Setup](https://github.com/AbdBarho/stable-diffusion-webui-docker/wiki/Setup) and [Usage](https://github.com/AbdBarho/stable-diffusion-webui-docker/wiki/Usage) instructions, checkout the [FAQ](https://github.com/AbdBarho/stable-diffusion-webui-docker/wiki/FAQ) page if you face any problems, or create a new issue!
## Features
This repository provides multiple UIs for you to play around with stable diffusion:
Contributions are welcome! **Create a discussion first of what the problem is and what you want to contribute (before you implement anything)**
## Disclaimer
The authors of this project are not responsible for any content generated using this interface.
This license of this software forbids you from sharing any content that violates any laws, produce any harm to a person, disseminate any personal information that would be meant for harm, spread misinformation and target vulnerable groups. For the full list of restrictions please read [the license](./LICENSE).
## Thanks
Special thanks to everyone behind these awesome projects, without them, none of this would have been possible:
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.