Add Docker-related files to .gitignore

This commit is contained in:
User Name 2025-12-11 20:46:18 -06:00
parent 338d9ae3bb
commit 2505cc4bc9
4 changed files with 136 additions and 0 deletions

4
.gitignore vendored
View File

@ -24,3 +24,7 @@ web_custom_versions/
openapi.yaml openapi.yaml
filtered-openapi.yaml filtered-openapi.yaml
uv.lock uv.lock
# Docker
.dockerignore
docker-compose.override.yml

38
Dockerfile Normal file
View File

@ -0,0 +1,38 @@
# Build argument for base image selection
ARG BASE_IMAGE=nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04
# ----------------------
# Stage: Base Runtime
# ----------------------
FROM ${BASE_IMAGE} AS base
ENV DEBIAN_FRONTEND=noninteractive
ENV PIP_PREFER_BINARY=1
ENV PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && apt-get install -y \
python3.12 python3.12-venv git git-lfs wget \
libgl1 libglib2.0-0 libsm6 libxext6 libxrender1 \
ffmpeg \
espeak-ng libespeak-ng1 \
build-essential \
&& git lfs install \
&& ln -sf /usr/bin/python3.12 /usr/bin/python \
&& ln -sf /usr/bin/pip3 /usr/bin/pip \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
# Install OpenTelemetry packages for optional instrumentation
RUN pip install --no-cache-dir opentelemetry-distro opentelemetry-exporter-otlp
WORKDIR /app/ComfyUI
# Copy entrypoint and helper scripts
COPY scripts/docker-entrypoint.sh /app/ComfyUI/scripts/docker-entrypoint.sh
COPY scripts/comfy-node-install.sh /usr/local/bin/comfy-node-install
RUN chmod +x /app/ComfyUI/scripts/docker-entrypoint.sh && \
chmod +x /usr/local/bin/comfy-node-install
# Set entrypoint
ENTRYPOINT ["/app/ComfyUI/scripts/docker-entrypoint.sh"]

42
docker-compose.yml Normal file
View File

@ -0,0 +1,42 @@
services:
comfyui:
build:
context: .
dockerfile: Dockerfile
container_name: comfyui
ports:
- "8188:8188"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
ipc: host
volumes:
- .:/app/ComfyUI # Mount local repo (for git checkout updates)
- comfyui-models:/app/ComfyUI/models # Persist models
- comfyui-output:/app/ComfyUI/output # Persist outputs
- comfyui-input:/app/ComfyUI/input # Persist inputs
- comfyui-custom-nodes:/app/ComfyUI/custom_nodes # Persist custom nodes
- comfyui-user:/app/ComfyUI/user # Persist user settings/workflows
- comfyui-venv:/app/venv # Cache virtualenv
environment:
- TZ=America/Chicago
- PUID=1000
- PGID=1000
# OpenTelemetry environment variables (optional - set if you want OTEL)
# - OTEL_EXPORTER_OTLP_ENDPOINT=http://your-otel-collector:4317
# - OTEL_SERVICE_NAME=comfyui
# - OTEL_RESOURCE_ATTRIBUTES=service.name=comfyui
restart: unless-stopped
volumes:
comfyui-models:
comfyui-output:
comfyui-input:
comfyui-custom-nodes:
comfyui-user:
comfyui-venv:

View File

@ -0,0 +1,52 @@
#!/bin/bash
# comfy-node-install - Install ComfyUI custom nodes from GitHub repositories
# Usage: comfy-node-install <repo-url> [repo-url2 ...]
set -e
COMFYUI_DIR="${COMFYUI_DIR:-/app/ComfyUI}"
CUSTOM_NODES_DIR="${COMFYUI_DIR}/custom_nodes"
# Ensure custom_nodes directory exists
mkdir -p "${CUSTOM_NODES_DIR}"
install_node() {
local repo_url="$1"
if [ -z "$repo_url" ]; then
echo "Error: Repository URL is required"
return 1
fi
# Extract repository name from URL
local repo_name=$(basename "${repo_url}" .git)
# Handle full GitHub URLs or just repo paths
if [[ "$repo_url" != http* ]]; then
repo_url="https://github.com/${repo_url}"
fi
local target_dir="${CUSTOM_NODES_DIR}/${repo_name}"
echo "Installing custom node: ${repo_name} from ${repo_url}"
# Remove existing installation if it exists
if [ -d "${target_dir}" ]; then
echo " Removing existing installation..."
rm -rf "${target_dir}"
fi
# Clone the repository
if [ -n "${GIT_LFS_SKIP_SMUDGE}" ]; then
GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 "${repo_url}" "${target_dir}"
else
git clone --depth 1 "${repo_url}" "${target_dir}"
fi
echo " Successfully installed ${repo_name}"
}
# Install all provided repositories
for repo_url in "$@"; do
install_node "${repo_url}"
done