diff --git a/Dockerfile b/Dockerfile index b3a09eb..01187e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,9 +8,22 @@ RUN apt-get update && \ curl \ ffmpeg \ git \ - libgl1 libglib2.0-0 \ - libgl1-mesa-glx libglib2.0-0 libsm6 libxrender1 libxext6 \ + # TODO not sure all of this is required, remove unnnecessary + libegl1 \ libegl1-mesa-dev \ + libgl1 \ + libglib2.0-0 \ + libgl1-mesa-dev \ + libgl1-mesa-glx \ + libgles2 \ + libgles2-mesa-dev \ + libglib2.0-0 \ + libglvnd-dev \ + libglvnd0 \ + libglx0 \ + libsm6 \ + libxext6 \ + libxrender1 \ ninja-build \ python3.11 \ python3.11-dev \ @@ -26,6 +39,19 @@ RUN adduser --uid 1001 -q user && \ mkdir /app && chown user /app USER user +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 + +# for GLEW +ENV LD_LIBRARY_PATH /usr/lib64:$LD_LIBRARY_PATH + +# nvidia-container-runtime +ENV NVIDIA_VISIBLE_DEVICES all +ENV NVIDIA_DRIVER_CAPABILITIES compute,utility,graphics + +# Default pyopengl to EGL for good headless rendering support +ENV PYOPENGL_PLATFORM egl + RUN pip install --no-cache --index-url https://download.pytorch.org/whl/cu121 \ torch==2.2.0 torchvision==0.17.0 xformers==0.0.24 @@ -35,15 +61,32 @@ RUN git clone "https://github.com/comfyanonymous/ComfyUI.git" ./ && \ RUN pip install --no-cache -r requirements.txt WORKDIR /app/custom_nodes/ComfyUI-3D-Pack/ -COPY --chown=user:user ./ ./ - +COPY --chown=user:user requirements.txt requirements_post.txt ./ +COPY --chown=user:user simple-knn/ simple-knn/ +COPY --chown=user:user tgs/ tgs/ RUN pip install --no-cache -r requirements.txt \ # post requirements installation require gpu, setup # `nvidia-container-runtime`, for docker, see - # https://stackoverflow.com/a/61737404 + # https://stackoverflow.com/a/61737404 -r requirements_post.txt \ # those seem to be missed ninja scikit-learn rembg[gpu] open_clip_torch +WORKDIR /app/custom_nodes/ +RUN git clone "https://github.com/ltdrdata/ComfyUI-Impact-Pack" && \ + cd ComfyUI-Impact-Pack && \ + git reset --hard e1570e76799049fb0038f6232fd89800ab4565eb && \ + pip install --no-cache -r requirements.txt +RUN git clone "https://github.com/kijai/ComfyUI-KJNodes" && \ + cd ComfyUI-KJNodes && \ + git reset --hard 95ae8b067a8aa5825471189954579ffa02aa9256 && \ + pip install --no-cache -r requirements.txt +RUN git clone "https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite" && \ + cd ComfyUI-VideoHelperSuite && \ + git reset --hard f94597739f20dac331f9918a245149b6b00a60f2 && \ + pip install --no-cache -r requirements.txt + +COPY --chown=user:user ./ ComfyUI-3D-Pack/ + WORKDIR /app ENTRYPOINT [ "python", "main.py", "--listen", "0.0.0.0" ] diff --git a/README.md b/README.md index 1a21d09..4d78105 100644 --- a/README.md +++ b/README.md @@ -198,9 +198,41 @@ pip install -r requirements_post.txt **Plus:**
- For those who want to run it inside Google Colab, you can check the [install instruction from @lovisdotio](https://github.com/MrForExample/ComfyUI-3D-Pack/issues/13) -#### Install with docker: +#### Install and run with docker: -`docker build -t test . && docker run --rm -it -p8188:8188 test` +Gpu support during Docker build time is required to install all requirenents. +On Linux host you could setup `nvidia-container-runtime`. On Windows +it is quite different and not checked at moment. + +##### Linux setup: + +1. Install nvidia-container-runtime: + ```bash + sudo apt-get install nvidia-container-runtime + ``` + +1. Edit/create the /etc/docker/daemon.json with content: + ```json + { + "runtimes": { + "nvidia": { + "path": "/usr/bin/nvidia-container-runtime", + "runtimeArgs": [] + } + }, + "default-runtime": "nvidia" + } + ``` + +1. Restart docker daemon: + ```bash + sudo systemctl restart docker + ``` + +Finally build and run docker container with: +```bash +docker build -t comfy3d . && docker run --rm -it -p 8188:8188 --gpus all comfy3d +``` ## Run: Copy the files inside folder [__New_ComfyUI_Bats](./_New_ComfyUI_Bats/) to your ComfyUI root directory, and double click run_nvidia_gpu_miniconda.bat to start ComfyUI! diff --git a/configs/system.conf b/configs/system.conf index 65b7cf3..88b67d9 100644 --- a/configs/system.conf +++ b/configs/system.conf @@ -1,6 +1,10 @@ web{ clients_ip = [ 127.0.0.1, - 0.0.0.0 + 0.0.0.0, + // docker have default ip for host in container of subnet 172.17.0.0/16 + // althrought there would be 172.18.0.0 + 172.17.0.0, + 172.17.0.1, ] }