Initial Commit
This commit is contained in:
56
Dockerfile
Normal file
56
Dockerfile
Normal file
@@ -0,0 +1,56 @@
|
||||
# ComfyUI Docker Build File by John Aldred
|
||||
# http://www.johnaldred.com
|
||||
# http://github.com/kaouthia
|
||||
|
||||
# Use a minimal Python base image (adjust version as needed)
|
||||
FROM python:3.12-slim
|
||||
|
||||
# Allow passing in your host UID/GID (defaults 1000:1000)
|
||||
ARG UID=1000
|
||||
ARG GID=1000
|
||||
|
||||
# Install OS deps and create the non-root user
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends git \
|
||||
&& groupadd --gid ${GID} appuser \
|
||||
&& useradd --uid ${UID} --gid ${GID} --create-home --shell /bin/bash appuser \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Mesa/GL and GLib so OpenCV can load libGL.so.1 for ComfyUI-VideoHelperSuite
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
libgl1-mesa-glx \
|
||||
libglib2.0-0 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy and enable the startup script
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
# Switch to non-root user
|
||||
USER $UID:$GID
|
||||
|
||||
# make ~/.local/bin available on the PATH so scripts like tqdm, torchrun, etc. are found
|
||||
ENV PATH=/home/appuser/.local/bin:$PATH
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Clone the ComfyUI repository (replace URL with the official repo)
|
||||
RUN git clone https://github.com/comfyanonymous/ComfyUI.git
|
||||
|
||||
# Change directory to the ComfyUI folder
|
||||
WORKDIR /app/ComfyUI
|
||||
|
||||
# Install ComfyUI dependencies
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# (Optional) Clean up pip cache to reduce image size
|
||||
RUN pip cache purge
|
||||
|
||||
# Expose the port that ComfyUI will use (change if needed)
|
||||
EXPOSE 8188
|
||||
|
||||
# Run entrypoint first, then start ComfyUI
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["python","/app/ComfyUI/main.py","--listen","0.0.0.0"]
|
||||
31
docker-compose.yml
Normal file
31
docker-compose.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
# ComfyUI Docker Compose File by John Aldred
|
||||
# http://www.johnaldred.com
|
||||
# http://github.com/kaouthia
|
||||
|
||||
services:
|
||||
comfyk:
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
image: comfyui:latest
|
||||
container_name: comfyui
|
||||
ports:
|
||||
- "8188:8188"
|
||||
volumes:
|
||||
# persist your models, output, and settings:
|
||||
- c:/home/user/comfyui/models:/app/ComfyUI/models
|
||||
|
||||
# persist your output images:
|
||||
- c:/home/user/comfyui/output:/app/ComfyUI/output
|
||||
|
||||
# persist all your settings & extra nodes:
|
||||
- c:/home/user/comfyui/settings:/app/ComfyUI/user/default:rw
|
||||
|
||||
# persist just your saved flows (overrides the workflows/ in default):
|
||||
- c:/home/user/comfyui/flows:/app/ComfyUI/user/default/workflows:rw
|
||||
|
||||
runtime: nvidia
|
||||
environment:
|
||||
- NVIDIA_VISIBLE_DEVICES=all
|
||||
stdin_open: true
|
||||
tty: true
|
||||
restart: unless-stopped
|
||||
43
entrypoint.sh
Normal file
43
entrypoint.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ComfyUI Docker Startup File by John Aldred
|
||||
# http://www.johnaldred.com
|
||||
# http://github.com/kaouthia
|
||||
|
||||
set -e
|
||||
|
||||
CN_DIR=/app/ComfyUI/custom_nodes
|
||||
declare -A REPOS=(
|
||||
["ComfyUI-Manager"]="https://github.com/ltdrdata/ComfyUI-Manager.git"
|
||||
["ComfyUI_essentials"]="https://github.com/cubiq/ComfyUI_essentials.git"
|
||||
["ComfyUI-Crystools"]="https://github.com/crystian/ComfyUI-Crystools.git"
|
||||
["rgthree-comfy"]="https://github.com/rgthree/rgthree-comfy.git"
|
||||
["ComfyUI-KJNodes"]="https://github.com/kijai/ComfyUI-KJNodes.git"
|
||||
["ComfyUI_UltimateSDUpscale"]="https://github.com/ssitu/ComfyUI_UltimateSDUpscale.git"
|
||||
)
|
||||
|
||||
echo "↳ Syncing custom_nodes…"
|
||||
mkdir -p "$CN_DIR"
|
||||
for name in "${!REPOS[@]}"; do
|
||||
url="${REPOS[$name]}"
|
||||
target="$CN_DIR/$name"
|
||||
|
||||
if [ -d "$target" ]; then
|
||||
echo " ↳ $name already exists, skipping clone"
|
||||
else
|
||||
echo " ↳ Cloning $name"
|
||||
git clone --depth 1 "$url" "$target"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "↳ Installing/upgrading dependencies…"
|
||||
for dir in "$CN_DIR"/*/; do
|
||||
req="$dir/requirements.txt"
|
||||
if [ -f "$req" ]; then
|
||||
echo " ↳ pip install --upgrade -r $req"
|
||||
pip install --no-cache-dir --upgrade -r "$req"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "↳ Launching ComfyUI"
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user