From cd50c9265a6c7cb67ac8d731e2431ceeceab9424 Mon Sep 17 00:00:00 2001 From: clsferguson <48876201+clsferguson@users.noreply.github.com> Date: Sat, 6 Sep 2025 21:41:07 -0600 Subject: [PATCH] Add Dockerfile for ComfyUI application setup --- Dockerfile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..a88d18348 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,50 @@ +# Use a recent slim base image +FROM python:3.13.7-slim-trixie + +# Environment +ENV DEBIAN_FRONTEND=noninteractive \ + PYTHONUNBUFFERED=1 \ + COMFY_AUTO_INSTALL=1 \ + PIP_DISABLE_PIP_VERSION_CHECK=1 \ + PIP_NO_CACHE_DIR=1 + +# System deps +RUN apt-get update && apt-get install -y --no-install-recommends \ + git \ + build-essential \ + libgl1 \ + libglx-mesa0 \ + libglib2.0-0 \ + fonts-dejavu-core \ + fontconfig \ + util-linux \ + && rm -rf /var/lib/apt/lists/* + +# Create runtime user/group +RUN groupadd --gid 1000 appuser \ + && useradd --uid 1000 --gid 1000 --create-home --shell /bin/bash appuser + +# Workdir (created automatically if missing) +WORKDIR /app/ComfyUI + +# Leverage layer caching: install deps before copying full tree +COPY requirements.txt ./ +RUN python -m pip install --upgrade pip setuptools wheel \ + && python -m pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu129 \ + && python -m pip install -r requirements.txt \ + && python -m pip install imageio-ffmpeg + +# Copy the application +COPY . . + +# Entrypoint +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh \ + && chown -R appuser:appuser /app /home/appuser /entrypoint.sh + +EXPOSE 8188 + +# Start as root so entrypoint can adjust ownership and drop privileges +USER root +ENTRYPOINT ["/entrypoint.sh"] +CMD ["python", "main.py", "--listen", "0.0.0.0"]