mirror of
https://github.com/AbdBarho/stable-diffusion-webui-docker.git
synced 2026-03-20 12:04:46 +01:00
parent
541965b37c
commit
0eee719776
|
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -Eeuo pipefail
|
|
||||||
|
|
||||||
find services -name "*.sh" -exec git update-index --chmod=+x {} \;
|
|
||||||
find .devscripts -name "*.sh" -exec git update-index --chmod=+x {} \;
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
mkdir -p data/.cache data/StableDiffusion data/Codeformer data/GFPGAN data/ESRGAN data/BSRGAN data/RealESRGAN data/SwinIR data/LDSR data/embeddings
|
|
||||||
|
|
||||||
cp -vf cache/models/model.ckpt data/StableDiffusion/model.ckpt
|
|
||||||
|
|
||||||
cp -vf cache/models/LDSR.ckpt data/LDSR/model.ckpt
|
|
||||||
cp -vf cache/models/LDSR.yaml data/LDSR/project.yaml
|
|
||||||
|
|
||||||
cp -vf cache/models/RealESRGAN_x4plus.pth data/RealESRGAN/
|
|
||||||
cp -vf cache/models/RealESRGAN_x4plus_anime_6B.pth data/RealESRGAN/
|
|
||||||
|
|
||||||
cp -vrf cache/torch data/.cache/
|
|
||||||
|
|
||||||
mkdir -p data/.cache/huggingface/transformers/
|
|
||||||
cp -vrf cache/transformers/* data/.cache/huggingface/transformers/
|
|
||||||
|
|
||||||
cp -v cache/custom-models/* data/StableDiffusion/
|
|
||||||
|
|
||||||
mkdir -p data/.cache/clip/
|
|
||||||
cp -vf cache/weights/ViT-L-14.pt data/.cache/clip/
|
|
||||||
|
|
||||||
cp -vf cache/weights/codeformer.pth data/Codeformer/codeformer-v0.1.0.pth
|
|
||||||
|
|
||||||
cp -vf cache/weights/detection_Resnet50_Final.pth data/.cache/
|
|
||||||
cp -vf cache/weights/parsing_parsenet.pth data/.cache/
|
|
||||||
|
|
||||||
cp -v embeddings/* data/embeddings/
|
|
||||||
|
|
||||||
echo this script was created 10/2022
|
|
||||||
echo Dont forget to run: docker compose --profile download up --build
|
|
||||||
echo the cache and embeddings folders can be deleted, but its not necessary.
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -Eeuo pipefail
|
|
||||||
|
|
||||||
echo "Moving everything in output to output/old..."
|
|
||||||
mv output old
|
|
||||||
mkdir output
|
|
||||||
mv old/.gitignore output
|
|
||||||
mv old output
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -Eeuo pipefail
|
|
||||||
|
|
||||||
echo "Renaming..."
|
|
||||||
|
|
||||||
# compatible with default auto-names
|
|
||||||
mv -v ./data/StableDiffusion ./data/Stable-diffusion
|
|
||||||
mv -v ./data/Deepdanbooru ./data/torch_deepdanbooru
|
|
||||||
|
|
||||||
# casing problem on windows
|
|
||||||
mv -v ./data/Hypernetworks ./data/hypernetworks1
|
|
||||||
mv -v ./data/hypernetworks1 ./data/hypernetworks
|
|
||||||
|
|
||||||
mv -v ./data/MiDaS ./data/midas1
|
|
||||||
mv -v ./data/midas1 ./data/midas
|
|
||||||
|
|
||||||
|
|
||||||
echo "Moving folders..."
|
|
||||||
|
|
||||||
mkdir -pv ./final
|
|
||||||
|
|
||||||
mv -v ./data/config ./final/config
|
|
||||||
mv -v ./data/.cache ./final/.cache
|
|
||||||
mv -v ./data/embeddings ./final/embeddings
|
|
||||||
mv -v ./data ./final/models
|
|
||||||
|
|
||||||
mv -v ./final ./data
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
end_of_line = lf
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
charset = utf-8
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
19
.env.example
19
.env.example
|
|
@ -1,4 +1,23 @@
|
||||||
|
#=====================================================================#
|
||||||
|
# Server Configuration #
|
||||||
|
#=====================================================================#
|
||||||
|
|
||||||
PUID=1000
|
PUID=1000
|
||||||
PGID=1000
|
PGID=1000
|
||||||
|
|
||||||
DEVICE_DRIVER=nvidia
|
DEVICE_DRIVER=nvidia
|
||||||
|
|
||||||
|
#=====================================================================#
|
||||||
|
# Automatic1111 Configuration #
|
||||||
|
#=====================================================================#
|
||||||
|
|
||||||
|
AUTO_WEBUI_PORT=7860
|
||||||
|
AUTO_CLI_ARGS="--allow-code --medvram --xformers --enable-insecure-extension-access --api"
|
||||||
|
# AUTO_CLI_ARGS="--no-half --precision full --allow-code --enable-insecure-extension-access --api"
|
||||||
|
|
||||||
|
#=====================================================================#
|
||||||
|
# ComfyUI Configuration #
|
||||||
|
#=====================================================================#
|
||||||
|
|
||||||
|
COMFY_WEBUI_PORT=8188
|
||||||
|
COMFY_CLI_ARGS=
|
||||||
|
|
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,5 +1,6 @@
|
||||||
|
# Docker
|
||||||
/.devcontainer
|
/.devcontainer
|
||||||
/docker-compose.override.yml
|
.env
|
||||||
|
|
||||||
# VSCode specific
|
# VSCode specific
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,4 @@
|
||||||
x-base_service: &base_service
|
name: stable-diffusion-webui-docker
|
||||||
user: ${PUID:-1000}:${PGID:-1000}
|
|
||||||
environment:
|
|
||||||
- PUID=${PUID:-1000}
|
|
||||||
- PGID=${PGID:-1000}
|
|
||||||
ports:
|
|
||||||
- "${WEBUI_PORT:-7860}:7860"
|
|
||||||
volumes:
|
|
||||||
- &v1 ./data:/data
|
|
||||||
- &v2 ./output:/output
|
|
||||||
stop_signal: SIGKILL
|
|
||||||
tty: true
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
reservations:
|
|
||||||
devices:
|
|
||||||
- driver: nvidia
|
|
||||||
device_ids: ['0']
|
|
||||||
capabilities: [compute, utility]
|
|
||||||
|
|
||||||
name: webui-docker
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
download:
|
download:
|
||||||
|
|
@ -29,34 +9,66 @@ services:
|
||||||
- PUID=${PUID:-1000}
|
- PUID=${PUID:-1000}
|
||||||
- PGID=${PGID:-1000}
|
- PGID=${PGID:-1000}
|
||||||
volumes:
|
volumes:
|
||||||
- *v1
|
- ./data:/data
|
||||||
|
|
||||||
auto: &automatic
|
auto:
|
||||||
<<: *base_service
|
|
||||||
profiles: ["auto"]
|
profiles: ["auto"]
|
||||||
build: ./services/AUTOMATIC1111
|
build: ./services/AUTOMATIC1111
|
||||||
image: sd-auto:78
|
image: auto:v1.10.1
|
||||||
|
user: ${PUID:-1000}:${PGID:-1000}
|
||||||
environment:
|
environment:
|
||||||
- CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api
|
- PUID=${PUID:-1000}
|
||||||
|
- PGID=${PGID:-1000}
|
||||||
|
- CLI_ARGS=${AUTO_CLI_ARGS}
|
||||||
|
ports:
|
||||||
|
- "7860:7860" # hardcoded in Dockerfile for now
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
||||||
|
- ./output:/output
|
||||||
|
stop_signal: SIGKILL
|
||||||
|
tty: true
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
reservations:
|
||||||
|
devices:
|
||||||
|
- driver: nvidia
|
||||||
|
device_ids: ['0']
|
||||||
|
capabilities: [compute, utility]
|
||||||
|
|
||||||
auto-cpu:
|
comfy:
|
||||||
<<: *automatic
|
|
||||||
profiles: ["auto-cpu"]
|
|
||||||
deploy: {}
|
|
||||||
environment:
|
|
||||||
- CLI_ARGS=--no-half --precision full --allow-code --enable-insecure-extension-access --api
|
|
||||||
|
|
||||||
comfy: &comfy
|
|
||||||
<<: *base_service
|
|
||||||
profiles: ["comfy"]
|
profiles: ["comfy"]
|
||||||
build: ./services/comfy/
|
build: ./services/comfy/
|
||||||
image: sd-comfy:7
|
image: comfy:v0.3.39
|
||||||
|
user: ${PUID:-1000}:${PGID:-1000}
|
||||||
environment:
|
environment:
|
||||||
- CLI_ARGS=
|
- PUID=${PUID:-1000}
|
||||||
|
- PGID=${PGID:-1000}
|
||||||
|
- CLI_ARGS=${COMFY_CLI_ARGS}
|
||||||
|
ports:
|
||||||
|
- "8188:8188" # hardcoded in Dockerfile for now
|
||||||
|
volumes:
|
||||||
|
# - ./comfy/extra_model_paths.yaml:/extra_model_paths.yaml:ro,cached
|
||||||
|
- ./data:/data:delegated
|
||||||
|
- ./output:/output
|
||||||
|
stop_signal: SIGKILL
|
||||||
|
tty: true
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
reservations:
|
||||||
|
devices:
|
||||||
|
- driver: nvidia
|
||||||
|
device_ids: ['0']
|
||||||
|
capabilities: [compute, utility]
|
||||||
|
|
||||||
comfy-cpu:
|
# Version auto1111, use same or similar base images
|
||||||
<<: *comfy
|
# Fix Mappings for models `/data/models` and `data/config/comfy/models` the later is created by ComfyManager
|
||||||
profiles: ["comfy-cpu"]
|
# Run everything in an venv
|
||||||
deploy: {}
|
# IPAdapterPlus
|
||||||
environment:
|
# ONNX
|
||||||
- CLI_ARGS=--cpu
|
# comfyui-manager by default
|
||||||
|
|
||||||
|
# Model/Embeddings
|
||||||
|
# /data/config/comfy
|
||||||
|
# /data/config/auto
|
||||||
|
# /data/config/shared
|
||||||
|
# Also move /output to /data/output
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@ ENV PIP_PREFER_BINARY=1
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/var/cache/apt \
|
RUN --mount=type=cache,target=/var/cache/apt \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y git wget curl jq ffmpeg libgl1-mesa-glx libglib2.0-0 && \
|
apt-get install -y --no-install-recommends git wget curl jq ffmpeg libgl1-mesa-glx libglib2.0-0 && \
|
||||||
apt-get clean
|
apt-get clean && \
|
||||||
|
pip install --no-input --upgrade pip
|
||||||
|
|
||||||
# Explore how we can use the CLI to do this instead
|
|
||||||
# https://docs.comfy.org/installation/system_requirements
|
|
||||||
# https://docs.comfy.org/comfy-cli/getting-started
|
|
||||||
FROM base AS application
|
FROM base AS application
|
||||||
|
|
||||||
RUN useradd -m -s /bin/bash comfy
|
RUN useradd -m -s /bin/bash comfy
|
||||||
|
|
@ -19,31 +17,43 @@ USER comfy
|
||||||
|
|
||||||
WORKDIR /home/comfy/app
|
WORKDIR /home/comfy/app
|
||||||
|
|
||||||
# Using CLI (with conda venv -can do venv without all this too)
|
SHELL ["/bin/bash", "--login", "-c"]
|
||||||
# python -m pip install -U pip && \
|
|
||||||
# pip install comfy-cli && \
|
# Setup ComfyUI project
|
||||||
# conda init bash && \
|
RUN git clone --branch v0.3.39 --depth 1 https://github.com/comfyanonymous/ComfyUI.git .
|
||||||
# conda create -n comfy-env python=3.11 && \
|
|
||||||
# conda activate comfy-env && \
|
|
||||||
# comfy install
|
|
||||||
RUN --mount=type=cache,target=/comfy/.cache/pip \
|
|
||||||
git clone --branch v0.3.30 --depth 1 https://github.com/comfyanonymous/ComfyUI.git . && \
|
|
||||||
mkdir -p .local/bin && \
|
|
||||||
pip install -r requirements.txt && \
|
|
||||||
pip install onnxruntime-gpu
|
|
||||||
# Should make ONNX optional by moving this into a configuration file that can be alterated at run time
|
|
||||||
|
|
||||||
COPY --chown=comfy:comfy . .
|
COPY --chown=comfy:comfy . .
|
||||||
|
|
||||||
RUN chmod u+x ./entrypoint.sh
|
# Setup venv
|
||||||
|
# # https://pythonspeed.com/articles/activate-virtualenv-dockerfile/
|
||||||
|
ENV VIRTUAL_ENV=/home/comfy/app/.venv
|
||||||
|
RUN --mount=type=cache,target=~/.cache/pip \
|
||||||
|
mkdir -p ~/.local/bin && \
|
||||||
|
python -m venv $VIRTUAL_ENV
|
||||||
|
|
||||||
ENV PATH="/home/comfy/.local/bin:${PATH}"
|
ENV PATH="/home/comfy/.local/bin:$PATH"
|
||||||
ENV PYTHONPATH="${PYTHONPATH}:${PWD}"
|
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||||
|
# ENV PYTHONPATH="${PYTHONPATH}:${PWD}"
|
||||||
|
|
||||||
|
# Activate environment and install dependencies
|
||||||
|
# Should make ONNX optional by moving this into a configuration file that can be alterated at run time
|
||||||
|
RUN --mount=type=cache,target=~/.cache/pip \
|
||||||
|
pip install -r requirements.txt && \
|
||||||
|
pip install onnxruntime-gpu && \
|
||||||
|
chmod u+x ./entrypoint.sh
|
||||||
|
|
||||||
ENV NVIDIA_VISIBLE_DEVICES=all
|
ENV NVIDIA_VISIBLE_DEVICES=all
|
||||||
ENV CLI_ARGS=""
|
ENV CLI_ARGS=""
|
||||||
|
|
||||||
EXPOSE 7860
|
EXPOSE 8188
|
||||||
|
|
||||||
ENTRYPOINT ["./entrypoint.sh"]
|
ENTRYPOINT ["./entrypoint.sh"]
|
||||||
CMD python -u main.py --listen --port 7860 ${CLI_ARGS}
|
CMD python -u main.py --listen --port 8188 ${CLI_ARGS}
|
||||||
|
|
||||||
|
# Explore how we can use the CLI to do this instead
|
||||||
|
# https://docs.comfy.org/installation/system_requirements
|
||||||
|
# https://docs.comfy.org/comfy-cli/getting-started
|
||||||
|
# https://pythonspeed.com/articles/activate-conda-dockerfile/
|
||||||
|
# https://pythonspeed.com/articles/multi-stage-docker-python/
|
||||||
|
# pip install comfy-cli && \
|
||||||
|
# comfy install
|
||||||
|
|
@ -3,27 +3,25 @@
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
BASE_DIRECTORY="/data/config/comfy"
|
BASE_DIRECTORY="/data/config/comfy"
|
||||||
OUTPUT_DIRECTORY="/data/output"
|
OUTPUT_DIRECTORY="/output"
|
||||||
|
|
||||||
mkdir -vp ${BASE_DIRECTORY}
|
|
||||||
mkdir -vp ${BASE_DIRECTORY}
|
mkdir -vp ${BASE_DIRECTORY}
|
||||||
mkdir -vp ${BASE_DIRECTORY}/temp
|
mkdir -vp ${BASE_DIRECTORY}/temp
|
||||||
mkdir -vp ${BASE_DIRECTORY}/user
|
mkdir -vp ${BASE_DIRECTORY}/user
|
||||||
mkdir -vp ${BASE_DIRECTORY}/custom_nodes
|
mkdir -vp ${BASE_DIRECTORY}/custom_nodes
|
||||||
mkdir -vp ${OUTPUT_DIRECTORY}
|
mkdir -vp ${OUTPUT_DIRECTORY}
|
||||||
|
|
||||||
|
# @brian - Why is this here?
|
||||||
# XDG_CACHE_HOME - Set cache outside container
|
# XDG_CACHE_HOME - Set cache outside container
|
||||||
mkdir -vp /data/.cache
|
# mkdir -vp /data/.cache
|
||||||
XDG_CACHE_HOME=/data/.cache
|
# XDG_CACHE_HOME=/data/.cache
|
||||||
export XDG_CACHE_HOME
|
# export XDG_CACHE_HOME
|
||||||
|
|
||||||
# --base-directory BASE_DIRECTORY
|
# --base-directory BASE_DIRECTORY
|
||||||
# Set the ComfyUI base directory for models,
|
# Set the ComfyUI base directory for models,
|
||||||
# custom_nodes, input, output, temp, and user directories.
|
# custom_nodes, input, output, temp, and user directories.
|
||||||
CLI_ARGS+="${CLI_ARGS} --base-directory ${BASE_DIRECTORY} --output-directory ${OUTPUT_DIRECTORY}"
|
CLI_ARGS+="${CLI_ARGS} --base-directory ${BASE_DIRECTORY} --output-directory ${OUTPUT_DIRECTORY}"
|
||||||
|
|
||||||
echo ${CLI_ARGS}
|
|
||||||
|
|
||||||
if [ -f "/data/config/comfy/startup.sh" ]; then
|
if [ -f "/data/config/comfy/startup.sh" ]; then
|
||||||
pushd ${APPLICATION_ROOT}
|
pushd ${APPLICATION_ROOT}
|
||||||
. /data/config/comfy/startup.sh
|
. /data/config/comfy/startup.sh
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
# https://github.com/comfyanonymous/ComfyUI/blob/master/extra_model_paths.yaml.example
|
# https://github.com/comfyanonymous/ComfyUI/blob/master/extra_model_paths.yaml.example
|
||||||
|
# https://comfyui-wiki.com/en/tutorial/basic/link-models-between-comfyui-and-a1111
|
||||||
a111:
|
a111:
|
||||||
base_path: /data
|
base_path: /data
|
||||||
|
|
||||||
checkpoints: models/Stable-diffusion
|
checkpoints: models/Stable-diffusion
|
||||||
configs: models/Stable-diffusion
|
configs: models/Stable-diffusion
|
||||||
vae: models/VAE
|
vae: models/VAE
|
||||||
loras: models/Lora
|
loras: |
|
||||||
|
models/Lora
|
||||||
|
models/LyCORIS
|
||||||
upscale_models: |
|
upscale_models: |
|
||||||
models/RealESRGAN
|
models/RealESRGAN
|
||||||
models/ESRGAN
|
models/ESRGAN
|
||||||
|
|
@ -20,16 +23,20 @@ a111:
|
||||||
comfyui:
|
comfyui:
|
||||||
base_path: /data
|
base_path: /data
|
||||||
|
|
||||||
# custom_nodes: config/comfy/custom_nodes
|
custom_nodes: config/comfy/custom_nodes
|
||||||
|
download_model_base: data/models
|
||||||
|
|
||||||
# TODO: I am unsure about these, need more testing
|
# TODO: I am unsure about these, need more testing
|
||||||
# style_models: data/config/comfy/style_models
|
# style_models: data/config/comfy/style_models
|
||||||
# t2i_adapter: data/config/comfy/t2i_adapter
|
# t2i_adapter: data/config/comfy/t2i_adapter
|
||||||
# clip_vision: data/config/comfy/clip_vision
|
# clip_vision: data/config/comfy/clip_vision
|
||||||
# diffusers: data/config/comfy/diffusers
|
# diffusers: data/config/comfy/diffusers
|
||||||
# download_model_base: data/models
|
|
||||||
|
|
||||||
# Need this file to be loaded dynamically maybe as a vol?
|
# Need to install ipadapter and set mappings
|
||||||
|
# https://github.com/cubiq/ComfyUI_IPAdapter_plus
|
||||||
|
# Create an auto installer? Is there a newer plugin/extension?
|
||||||
|
|
||||||
|
# Need this file to be loaded dynamically maybe as a vol? Currently these are being downloaded to /data/config/comfy/models
|
||||||
# - `ultralytics_bbox` - Specifies the paths for bbox YOLO models.
|
# - `ultralytics_bbox` - Specifies the paths for bbox YOLO models.
|
||||||
# - `ultralytics_segm` - Specifies the paths for segm YOLO models.
|
# - `ultralytics_segm` - Specifies the paths for segm YOLO models.
|
||||||
# - `ultralytics` - Allows the presence of `bbox/` and `segm/` subdirectories.
|
# - `ultralytics` - Allows the presence of `bbox/` and `segm/` subdirectories.
|
||||||
1
services/trellis/README.md
Normal file
1
services/trellis/README.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
https://github.com/microsoft/TRELLIS/issues/14
|
||||||
Loading…
Reference in a new issue