#!/bin/sh # Entrypoint wrapper. Pip-installs requirements.txt for any custom_node # present in /opt/comfyui/custom_nodes/, then exec's the CMD. # # This makes the container self-healing for custom nodes that get added # at runtime — either via ComfyUI-Manager from the web UI, or by # git-cloning directly into the comfyui-custom-nodes volume. Pip skips # already-satisfied requirements quickly, so the boot-time cost on # subsequent restarts is negligible. set -e if [ -d /opt/comfyui/custom_nodes ]; then for req in /opt/comfyui/custom_nodes/*/requirements.txt; do [ -f "$req" ] || continue echo "[entrypoint] installing $req" pip install -q -r "$req" || echo " (install failed — continuing)" done fi # Force-pin known-incompatible packages back into a working range. Some # custom nodes bring transformers >=5 transitively, which removes # BertModel.get_head_mask and breaks comfyui_segment_anything's # GroundingDINO. Run last so it wins over anything the loop above # installed. pip install -q "transformers>=4.40,<5" || echo "[entrypoint] transformers pin failed — continuing" exec "$@"