Merge pull request #119 from kalemas/docker-build

Fix eglInitialize() failed issue
This commit is contained in:
Mr. For Example
2024-03-21 09:30:54 +01:00
committed by GitHub
3 changed files with 87 additions and 8 deletions
+48 -5
View File
@@ -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" ]
+34 -2
View File
@@ -198,9 +198,41 @@ pip install -r requirements_post.txt
**Plus:**<br>
- 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!
+5 -1
View File
@@ -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,
]
}