feat: ComfyUI embedded dev setup + proxy auth with downstream keys

- COMFYUI_BASE configurable via env var (default 127.0.0.1:8188)
- All /api/comfyui/ routes protected by downstream API Key or admin token
- docker/Dockerfile.comfyui + docker-compose.comfyui.yml for dev
- npm scripts: comfyui:install, comfyui:start, comfyui:stop
- .gitignore / .env.example updated
This commit is contained in:
boos
2026-05-17 13:04:46 +08:00
parent 2fe8d8528a
commit ad0bb86e31
11 changed files with 308 additions and 7 deletions
+27
View File
@@ -0,0 +1,27 @@
FROM python:3.11-slim
WORKDIR /workspace
# Install system deps
RUN apt-get update && apt-get install -y --no-install-recommends \
git curl \
&& rm -rf /var/lib/apt/lists/*
# Clone ComfyUI
RUN git clone https://github.com/comfyanonymous/ComfyUI.git /workspace/ComfyUI
WORKDIR /workspace/ComfyUI
# Python venv + deps (CPU-only, generation goes through BoosAPI)
RUN python3 -m venv venv && \
. venv/bin/activate && \
pip install --upgrade pip && \
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu && \
grep -v kornia_rs requirements.txt | pip install -r /dev/stdin && \
rm -rf ~/.cache/pip
ENV PATH="/workspace/ComfyUI/venv/bin:${PATH}"
EXPOSE 8188
CMD ["python3", "main.py", "--listen", "0.0.0.0", "--port", "8188", "--cpu"]
+22
View File
@@ -0,0 +1,22 @@
# docker-compose.comfyui.yml
# 开发环境:在 BoosAPI 旁边运行 ComfyUI
# 使用: docker compose -f docker/docker-compose.yml -f docker/docker-compose.comfyui.yml up -d
services:
comfyui:
build:
context: ..
dockerfile: docker/Dockerfile.comfyui
ports:
- "127.0.0.1:8188:8188"
volumes:
- comfyui-data:/workspace
- ../boosapi_comfy_nodes.py:/workspace/ComfyUI/custom_nodes/boosapi_comfy_nodes.py
environment:
- BOOSAPI_BASE=http://host.docker.internal:4000/v1
- BOOSAPI_KEY=${BOOSAPI_KEY:-sk-demo-user}
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
comfyui-data: