diff --git a/Dockerfile b/Dockerfile index bc4be83dd..ccdaa4be3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 user’s 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 user’s 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 +# ComfyUI’s 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 diff --git a/compose.yaml b/compose.yaml index 52087f337..d242b05a4 100644 --- a/compose.yaml +++ b/compose.yaml @@ -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 diff --git a/entrypoint.sh b/entrypoint.sh index a0aabb65d..37e576452 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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