FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive ENV PIP_BREAK_SYSTEM_PACKAGES=1 ARG USE_PERSISTENT_DATA=false ENV USE_PERSISTENT_DATA=${USE_PERSISTENT_DATA} RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ git \ git-lfs \ ffmpeg \ libgl1 \ libglib2.0-0 \ netcat-openbsd \ && rm -rf /var/lib/apt/lists/* \ && git lfs install RUN ln -s /usr/bin/python3 /usr/bin/python RUN python3 -m pip install --upgrade pip RUN pip install --no-cache-dir --upgrade setuptools wheel RUN pip install --no-cache-dir \ torch torchvision --index-url https://download.pytorch.org/whl/cu121 RUN pip install --no-cache-dir \ datasets \ huggingface-hub \ "protobuf<4" \ "click<8.1" \ gradio RUN useradd -m -u 1000 comfyuser RUN mkdir -p /home/comfyuser/app && chown -R comfyuser:comfyuser /home/comfyuser USER comfyuser ENV HOME=/home/comfyuser WORKDIR $HOME RUN git clone https://github.com/Comfy-Org/ComfyUI.git app WORKDIR $HOME/app RUN pip install --no-cache-dir -r requirements.txt RUN mkdir -p custom_nodes && cd custom_nodes && \ git clone https://github.com/ltdrdata/ComfyUI-Manager.git && \ git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack --depth 1 && \ git clone https://github.com/ltdrdata/ComfyUI-Impact-Subpack --depth 1 && \ git clone https://github.com/fofr/ComfyUI-AdvancedLivePortrait --depth 1 && \ for dir in */; do \ if [ -f "$dir/requirements.txt" ]; then \ pip install --no-cache-dir -r "$dir/requirements.txt"; \ fi; \ if [ -f "$dir/install.py" ]; then \ cd "$dir" && python install.py && cd ..; \ fi; \ done COPY app.py app.py COPY workflow_api.json workflow_api.json COPY entrypoint.sh /entrypoint.sh USER root RUN chmod +x /entrypoint.sh USER comfyuser ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]