diff --git a/ComfyUI/Dockerfile b/ComfyUI/Dockerfile new file mode 100644 index 0000000..7762d76 --- /dev/null +++ b/ComfyUI/Dockerfile @@ -0,0 +1,36 @@ +ARG PYTHON_VERSION=3.10 +ARG ROCM_VERSION=6.1 + +# we do not use rocm/pytorch as it currently use python 3.7 and we require >=python 3.10 +FROM rocm/rocm-terminal:${ROCM_VERSION} +ARG PYTHON_VERSION +ARG ROCM_VERSION + +# switch to root for setup +USER root + +RUN git clone https://github.com/comfyanonymous/ComfyUI.git /app +WORKDIR /app +RUN apt update \ + && apt upgrade -y \ + && apt install -y software-properties-common \ + && add-apt-repository ppa:deadsnakes/ppa \ + && apt update \ + && apt install -y python${PYTHON_VERSION}-full \ + && curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \ + && chown -R 1000:1000 /app \ + && rm -rf /var/lib/apt/lists/* + +# switch back to unpreviledged user +USER 1000 +RUN python${PYTHON_VERSION} -m venv /app/env \ + && /app/env/bin/pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm${ROCM_VERSION} \ + && /app/env/bin/pip install --no-cache-dir -r requirements.txt + +VOLUME ["/app/models/loras", "/app/models/checkpoints", "/app/models/vae", "/app/models/embeddings"] +VOLUME ["/app/outputs"] + +EXPOSE 8188 +ENV PYTORCH_CUDA_ALLOC_CONF="garbage_collection_threshold:0.9,max_split_size_mb:512" +ENTRYPOINT ["/app/env/bin/python", "main.py", "--listen"] +CMD [] \ No newline at end of file diff --git a/shared/lora/.gitignore b/ComfyUI/custom_nodes/.gitignore similarity index 100% rename from shared/lora/.gitignore rename to ComfyUI/custom_nodes/.gitignore diff --git a/shared/tensors/.gitignore b/ComfyUI/inputs/.gitignore similarity index 100% rename from shared/tensors/.gitignore rename to ComfyUI/inputs/.gitignore diff --git a/ComfyUI/outputs/.gitignore b/ComfyUI/outputs/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/ComfyUI/outputs/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index d3009ed..7e4c916 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,6 +1,10 @@ services: stable-diffusion-webui-forge: - build: ./stable-diffusion-webui-forge + build: + context: ./stable-diffusion-webui-forge + args: &buid_args + PYTHON_VERSION: "3.10" + ROCM_VERSION: "6.1" restart: unless-stopped environment: - HSA_OVERRIDE_GFX_VERSION=11.0.0 @@ -10,8 +14,8 @@ services: - /dev/kfd - /dev/dri volumes: - - ./shared/lora:/app/models/Lora - - ./shared/tensors:/app/models/Stable-diffusion + - ./shared/loras:/app/models/Lora + - ./shared/checkpoints:/app/models/Stable-diffusion - ./shared/vae/:/app/models/VAE - ./shared/embeddings:/app/embeddings - ./stable-diffusion-webui-forge/extensions:/app/extensions @@ -25,3 +29,31 @@ services: - SYS_PTRACE security_opt: - seccomp=unconfined + comfyui: + build: + context: ./ComfyUI + args: + <<: *buid_args + restart: unless-stopped + environment: + - HSA_OVERRIDE_GFX_VERSION=11.0.0 + ports: + - 8188:8188 + devices: + - /dev/kfd + - /dev/dri + volumes: + - ./shared/loras:/app/models/loras + - ./shared/checkpoints:/app/models/checkpoints + - ./shared/vae/:/app/models/vae + - ./shared/embeddings:/app/models/embeddings + - ./ComfyUI/custom_nodes:/app/custom_nodes + - ./ComfyUI/outputs:/app/output + - ./ComfyUI/inputs:/app/input + group_add: + - video + ipc: host + cap_add: + - SYS_PTRACE + security_opt: + - seccomp=unconfined \ No newline at end of file diff --git a/shared/checkpoints/.gitignore b/shared/checkpoints/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/shared/checkpoints/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/shared/loras/.gitignore b/shared/loras/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/shared/loras/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/stable-diffusion-webui-forge/Dockerfile b/stable-diffusion-webui-forge/Dockerfile index d3f6ff7..aa95fd1 100644 --- a/stable-diffusion-webui-forge/Dockerfile +++ b/stable-diffusion-webui-forge/Dockerfile @@ -3,6 +3,7 @@ ARG ROCM_VERSION=6.1 # we do not use rocm/pytorch as it currently use python 3.7 and we require >=python 3.10 FROM rocm/rocm-terminal:${ROCM_VERSION} + ARG PYTHON_VERSION ARG ROCM_VERSION @@ -22,13 +23,11 @@ RUN apt update \ && chown -R 1000:1000 /app \ && rm -rf /var/lib/apt/lists/* -# switch back to unpreviledged user -USER 1000 RUN python${PYTHON_VERSION} -m venv /app/env \ && sed -i'' -Ee "s/rocm[0-9]\.[0-9]/rocm${ROCM_VERSION}/g" webui.sh \ - && /app/env/bin/python -m pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm${ROCM_VERSION} \ - && /app/env/bin/python -m pip install --no-cache-dir -r requirements_versions.txt + && /app/env/bin/pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm${ROCM_VERSION} \ + && /app/env/bin/pip install --no-cache-dir -r requirements_versions.txt VOLUME ["/app/models/Lora", "/app/models/Stable-diffusion", "/app/models/VAE"] VOLUME ["/app/embeddings"]