feat(compose): add AMD-optimized ComfyUI service
Add a new ComfyUI service to the Docker Compose configuration, specifically tailored for AMD GPUs using ROCm. - Uses the rocm/pytorch base image for hardware acceleration - Includes an initialization script to clone and install ComfyUI on first boot - Configures necessary hardware device mappings (/dev/dri, /dev/kfd) and environment variables for AMD compatibility - Sets up persistent storage and network integration with the existing proxy and AI internal networks
This commit is contained in:
@@ -56,6 +56,52 @@ services:
|
||||
constraints:
|
||||
- node.role == manager
|
||||
|
||||
# --- IMAGE ENGINE: ComfyUI (AMD Optimized) ---
|
||||
comfyui:
|
||||
image: rocm/pytorch:rocm6.0_ubuntu22.04_py3.10_pytorch_2.1.2
|
||||
# Command to auto-install ComfyUI on first boot
|
||||
command: >
|
||||
bash -c "
|
||||
if [ ! -d /workspace/ComfyUI ]; then
|
||||
git clone https://github.com/comfyanonymous/ComfyUI /workspace/ComfyUI;
|
||||
cd /workspace/ComfyUI;
|
||||
pip install -r requirements.txt;
|
||||
fi;
|
||||
cd /workspace/ComfyUI;
|
||||
python3 main.py --listen 0.0.0.0 --port 8188 --preview-method auto
|
||||
"
|
||||
networks:
|
||||
- ai_internal
|
||||
- proxy
|
||||
deploy:
|
||||
replicas: 1
|
||||
placement:
|
||||
constraints:
|
||||
- node.labels.gpu == true
|
||||
|
||||
# Hardware Access
|
||||
devices:
|
||||
- /dev/dri:/dev/dri
|
||||
- /dev/kfd:/dev/kfd
|
||||
cap_add:
|
||||
- IPC_LOCK
|
||||
- SYS_PTRACE
|
||||
group_add:
|
||||
- video
|
||||
- render
|
||||
|
||||
volumes:
|
||||
# --- UPDATED PATH ---
|
||||
- /mnt/local-ssd/docker/comfyui:/workspace/ComfyUI
|
||||
# System Hardware Maps
|
||||
- /sys/class/drm:/sys/class/drm:ro
|
||||
- /sys/class/kfd:/sys/class/kfd:ro
|
||||
- /sys/devices:/sys/devices:ro
|
||||
|
||||
environment:
|
||||
- HSA_OVERRIDE_GFX_VERSION=10.3.0
|
||||
- CLI_ARGS=--listen 0.0.0.0 --port 8188
|
||||
|
||||
networks:
|
||||
ai_internal:
|
||||
external: true
|
||||
|
||||
Reference in New Issue
Block a user