diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index a326e3e..2837d85 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -21,12 +21,21 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: build and push comfyui + - name: build and push comfyui-cuda run: | docker buildx build \ --platform=linux/arm64 \ - -t mistox/comfyui-ampere \ - -f comfyui-dockerfile \ + -t mistox/comfyui-cuda-ampere \ + -f comfyui-cuda-dockerfile \ + --push \ + . + + - name: build and push comfyui-rocm + run: | + docker buildx build \ + --platform=linux/arm64 \ + -t mistox/comfyui-rocm-ampere \ + -f comfyui-rocm-dockerfile \ --push \ . diff --git a/comfyui-cuda-dockerfile b/comfyui-cuda-dockerfile new file mode 100644 index 0000000..49340f6 --- /dev/null +++ b/comfyui-cuda-dockerfile @@ -0,0 +1,34 @@ +# Get cuda version from https://hub.docker.com/r/nvidia/cuda +FROM nvcr.io/nvidia/pytorch:25.05-py3 AS build-deps + +# Install system dependencies +RUN pip install imageio controlnet_aux + +# Set working directory +WORKDIR /app + +# Clone ComfyUI +RUN git clone https://github.com/comfyanonymous/ComfyUI.git . + +# Link in python +RUN ln -sf /usr/bin/python3 /usr/bin/python && \ + ln -sf /usr/bin/pip3 /usr/bin/pip + +# Install +RUN grep -vE "^(torch|#)" requirements.txt | xargs pip install && \ + pip install torchsde + +# Set custom Nodes +WORKDIR /app/custom_nodes + +# Install ComfyUi Manager +RUN git clone https://github.com/Comfy-Org/ComfyUI-Manager.git + +# Go back to root +WORKDIR /app + +# Expose the default ComfyUI port +EXPOSE 8188 + +# Launch ComfyUI +CMD ["python3", "main.py", "--listen", "0.0.0.0"] \ No newline at end of file diff --git a/comfyui-dockerfile b/comfyui-dockerfile deleted file mode 100644 index e6998a9..0000000 --- a/comfyui-dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -# Get cuda version from https://hub.docker.com/r/nvidia/cuda -FROM nvcr.io/nvidia/pytorch:25.05-py3 AS build-deps - -WORKDIR /app - -# Get release version from https://github.com/comfyanonymous/ComfyUI/releases -ARG ComfyUI_Release=0.3.71 - -RUN pip install imageio controlnet_aux - -RUN wget https://github.com/comfyanonymous/ComfyUI/archive/refs/tags/v${ComfyUI_Release}.tar.gz && \ - tar xzf v${ComfyUI_Release}.tar.gz && \ - rm v${ComfyUI_Release}.tar.gz && \ - mv /app/ComfyUI-${ComfyUI_Release} /app/comfyui/ - -WORKDIR /app/comfyui - -RUN ln -sf /usr/bin/python3 /usr/bin/python && \ - ln -sf /usr/bin/pip3 /usr/bin/pip - -RUN grep -vE "^(torch|#)" requirements.txt | xargs pip install && \ - pip install torchsde - -WORKDIR /app/comfyui/custom_nodes - -RUN git clone https://github.com/Comfy-Org/ComfyUI-Manager.git - -WORKDIR /app/comfyui - -EXPOSE 8188 - -CMD ["python", "main.py", "--listen", "0.0.0.0"] diff --git a/comfyui-rocm-dockerfile b/comfyui-rocm-dockerfile new file mode 100644 index 0000000..0bf9176 --- /dev/null +++ b/comfyui-rocm-dockerfile @@ -0,0 +1,44 @@ +# Use the official ROCm base image +FROM rocm/dev-ubuntu-24.04:6.2 + +# Set environment variables for 7900 XTX (gfx1100) +ENV HSA_OVERRIDE_GFX_VERSION=11.0.0 +ENV TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1 +ENV PYTHONUNBUFFERED=1 + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + python3-pip \ + python3-venv \ + git \ + libgl1-mesa-glx \ + libglib2.0-0 \ + && rm -rf /var/lib/apt/lists/* + +# Set working directory +WORKDIR /app + +# Clone ComfyUI +RUN git clone https://github.com/comfyanonymous/ComfyUI.git . + +# Install PyTorch with ROCm 6.2 support (matching the base image) +RUN pip3 install --no-cache-dir torch torchvision torchaudio \ + --index-url https://download.pytorch.org/whl/rocm6.2 + +# Install ComfyUI dependencies +RUN pip3 install --no-cache-dir -r requirements.txt + +# Set custom Nodes +WORKDIR /app/custom_nodes + +# Install ComfyUi Manager +RUN git clone https://github.com/Comfy-Org/ComfyUI-Manager.git + +# Go back to root +WORKDIR /app + +# Expose the default ComfyUI port +EXPOSE 8188 + +# Launch ComfyUI +CMD ["python3", "main.py", "--listen", "0.0.0.0"] diff --git a/docker-compose.yml b/cuda-docker-compose.yml similarity index 81% rename from docker-compose.yml rename to cuda-docker-compose.yml index 67e8dfb..a03ece0 100644 --- a/docker-compose.yml +++ b/cuda-docker-compose.yml @@ -1,7 +1,6 @@ services: ollama: container_name: ai-ollama - runtime: nvidia pull_policy: always tty: true restart: unless-stopped @@ -12,6 +11,13 @@ services: - 7869:11434 environment: - OLLAMA_KEEP_ALIVE=24h + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: all + capabilities: [gpu] ollama-webui: image: ghcr.io/open-webui/open-webui:main @@ -37,8 +43,6 @@ services: image: docker.io/searxng/searxng:latest container_name: ai-searxng restart: always - ports: - - 8888:8080 volumes: - ./data/searxng/config:/etc/searxng - ./data/searxng/data:/var/cache/searxng @@ -58,14 +62,20 @@ services: comfyui: container_name: ai-comfyui - image: mistox/comfyui-ampere - runtime: nvidia + image: mistox/comfyui-cuda-ampere volumes: - ./data/comfyui/models:/app/comfyui/models - ./data/comfyui/output:/app/comfyui/output ports: - 8010:8188 restart: always + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: all + capabilities: [gpu] volumes: - uvicorn-src: + uvicorn-src: \ No newline at end of file diff --git a/rocm-docker-compose.yml b/rocm-docker-compose.yml new file mode 100644 index 0000000..b2b3f31 --- /dev/null +++ b/rocm-docker-compose.yml @@ -0,0 +1,80 @@ +services: + ollama: + container_name: ai-ollama + image: docker.io/ollama/ollama:latest # This is only X86_64 right now. Working on building an image for this on ROCM + restart: unless-stopped + pull_policy: always + tty: true + volumes: + - ./data/ollama/ollama:/root/.ollama + ports: + - 7869:11434 + environment: + - OLLAMA_KEEP_ALIVE=24h + - HSA_OVERRIDE_GFX_VERSION=11.0.0 # This is for the RX 7900XTX + devices: + - /dev/kfd:/dev/kfd # Shared surface driver for ROCm + - /dev/dri:/dev/dri # Direct Rendering Infrastructure for GPU access + + ollama-webui: + container_name: ai-ollama-webui + image: ghcr.io/open-webui/open-webui:main + volumes: + - ./data/ollama/ollama-webui:/app/backend/data + depends_on: + - ollama + ports: + - 8009:8080 + environment: # https://docs.openwebui.com/getting-started/env-configuration#default_models + - OLLAMA_BASE_URLS=http://host.docker.internal:7869 + - ENV=prod + - WEBUI_AUTH=True + - WEBUI_NAME=Mistox AI + - WEBUI_URL=http://ai.mistox.net:8080 + - WEBUI_SECRET_KEY=aops8gh948g@#50dfg00f + extra_hosts: + - host.docker.internal:host-gateway + restart: unless-stopped + + searxng: + container_name: ai-searxng + image: docker.io/searxng/searxng:latest + restart: always + ports: + - 8888:8080 + volumes: + - ./data/searxng/config:/etc/searxng + - ./data/searxng/data:/var/cache/searxng + + ai-uvicorn: + container_name: ai-uvicorn + image: mistox/uvicorn-ampere + ports: + - 8000:8000 + - 5678:5678 + volumes: + - uvicorn-src:/code/ollama-docker + restart: always + depends_on: + - ollama + - ollama-webui + + comfyui: + container_name: ai-comfyui + image: mistox/comfyui-rocm-ampere + restart: unless-stopped + pull_policy: always + ports: + - 8010:8188 + environment: + - HSA_OVERRIDE_GFX_VERSION=11.0.0 # This is for the RX 7900XTX + devices: + - /dev/kfd:/dev/kfd + - /dev/dri:/dev/dri + volumes: + - ./data/comfyui/models:/home/user/comfyui/models + - ./data/comfyui/output:/home/user/comfyui/output + - ./data/comfyui/custom_nodes:/home/user/comfyui/custom_nodes + +volumes: + uvicorn-src: