Split data volume

This commit is contained in:
B. Bergeron 2026-01-10 19:03:47 -05:00
parent 7795a4e86c
commit fa71050a07
No known key found for this signature in database
GPG Key ID: 20A0A88F22238925
3 changed files with 19 additions and 23 deletions

View File

@ -14,13 +14,6 @@ FROM python:3.12.12-trixie
# Install cmake, which is an indirect installation dependencies
RUN apt-get update && apt-get install -y --no-install-recommends cmake
# Create a mount point for user-generated data.
RUN mkdir -p \
/data/input \
/data/output \
/data/temp \
/data/user
# Create a regular user whose UID and GID will match the host user's at runtime.
# Also create a home directory for this user (-m), as some common Python tools
# (such as uv) interact with the users home directory.
@ -57,24 +50,24 @@ COPY requirements.txt manager_requirements.txt ./
RUN pip install --no-cache-dir --disable-pip-version-check \
-r requirements.txt
# Install ComfyUI and link the data mount points.
# Install ComfyUI
COPY . .
RUN ln -sf /data/* .
# Purely declarative: inform Docker and image users that this image is designed
# to listen on port 8188 for the web GUI.
EXPOSE 8188
# Declare persistent volumes:
# - /data: stores user-generated data from ComfyUI,
# - /comfyui/.venv: stores Python data generated by the entrypoint and custom
# node managers,
# - /comfyui/custom_nodes: stores custom nodes installed at runtime by custom
# node managers,
# - /comfyui/models: Stores models installed by model managers,
# - /home/comfyui: stores data from Python packages that may write outside the
# virtual environment and into the users home directory.
VOLUME [ "/data", "/comfyui/.venv", "/comfyui/custom_nodes", "/comfyui/models", "/home/comfyui" ]
# Declare persistent volumes. We assign one volume per data directory to match
# ComfyUIs natural file layout and to let users selectively choose which
# directories they want to mount.
VOLUME /comfyui/.venv
VOLUME /comfyui/custom_nodes
VOLUME /comfyui/input
VOLUME /comfyui/models
VOLUME /comfyui/output
VOLUME /comfyui/temp
VOLUME /comfyui/user
VOLUME /home/comfyui
# Switch back to root to run the entrypoint and to install additional system
# dependencies

View File

@ -19,11 +19,15 @@ services:
devices:
- capabilities: [gpu]
volumes:
# Share custom nodes and models with the container.
- ./custom_nodes:/comfyui/custom_nodes
- ./models:/comfyui/models
# Optional: mount the user data directory.
#- data:/data/
# (Optional) Mount host ComfyUI data directories
#
#- ./input:/comfyui/input
#- ./output:/comfyui/output
#- ./temp:/comfyui/temp
#- ./user:/comfyui/user
environment:
# Overwrite the container user's UID and GID to match the host's. This

View File

@ -24,7 +24,6 @@ fi
# the user's new UID and GID.
echo "[entrypoint] Changing directory ownership..."
chown -R "$user:$user_group" \
/data \
/comfyui \
/home/comfyui