Add Dockerfile for ComfyUI application setup

This commit is contained in:
clsferguson 2025-09-06 21:41:07 -06:00 committed by GitHub
parent 8322b3e83b
commit cd50c9265a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

50
Dockerfile Normal file
View File

@ -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"]