forked from YanWenKun/ComfyUI-Docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
244 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Publish 'comfy3d-pt23' to Docker Hub | ||
|
||
on: | ||
workflow_dispatch: # Can be manually triggered | ||
|
||
jobs: | ||
|
||
build-publish-comfy3d-pt23: | ||
environment: Publish to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Get current date | ||
id: date | ||
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT | ||
- | ||
name: Maximize build disk space | ||
uses: easimon/maximize-build-space@master | ||
with: | ||
overprovision-lvm: 'true' | ||
remove-android: 'true' | ||
- | ||
name: Git checkout | ||
uses: actions/checkout@v4 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_ACCESSTOKEN }} | ||
- | ||
name: Build and push 'comfy3d-pt23' | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./comfy3d-pt23 | ||
file: ./comfy3d-pt23/Dockerfile | ||
tags: | | ||
yanwk/comfyui-boot:comfy3d-pt23 | ||
yanwk/comfyui-boot:comfy3d-pt23-${{ steps.date.outputs.date }} | ||
push: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
################################################################################ | ||
# Dockerfile that builds 'yanwk/comfyui-boot:comfy3d-pt23' | ||
# An environment for running ComfyUI with ComfyUI-3D-Pack. | ||
# Using PyTorch 2.3 | ||
# Comfy3D Version: https://github.com/MrForExample/ComfyUI-3D-Pack/tree/30bc061d926f660e7f4822f54778df46326a8fec | ||
################################################################################ | ||
|
||
# https://gitlab.com/nvidia/container-images/cuda | ||
# https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda/tags | ||
FROM nvcr.io/nvidia/cuda:12.1.1-cudnn8-devel-ubi9 | ||
|
||
LABEL maintainer="YAN Wenkun <code@yanwk.fun>" | ||
|
||
################################################################################ | ||
# Python and tools | ||
# GCC 11 & Make is already included in the base image. | ||
|
||
RUN --mount=type=cache,target=/var/cache/dnf \ | ||
set -eu \ | ||
&& dnf upgrade -y --disablerepo cuda \ | ||
&& dnf install -y \ | ||
python3.11-devel \ | ||
python3.11-pip \ | ||
python3.11-Cython \ | ||
python3.11-numpy \ | ||
python3.11-requests \ | ||
python3.11-scipy \ | ||
python3.11-urllib3 \ | ||
git \ | ||
git-lfs \ | ||
less \ | ||
mesa-libGL \ | ||
mesa-libEGL \ | ||
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 100 \ | ||
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3.11 100 | ||
|
||
################################################################################ | ||
# Python Packages | ||
# Comfy3D doesn't use ONNX Runtime, so this image skipped it. | ||
|
||
RUN --mount=type=cache,target=/root/.cache/pip \ | ||
pip list \ | ||
&& pip install \ | ||
--upgrade pip wheel setuptools \ | ||
&& pip install \ | ||
xformers==0.0.27.post1 torchvision torchaudio \ | ||
--index-url https://download.pytorch.org/whl/cu121 \ | ||
--extra-index-url https://pypi.org/simple \ | ||
&& pip install \ | ||
-r https://raw.githubusercontent.com/comfyanonymous/ComfyUI/master/requirements.txt \ | ||
-r https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/requirements.txt \ | ||
-r https://raw.githubusercontent.com/MrForExample/ComfyUI-3D-Pack/3b4e715939376634c68aa4c1c7d4ea4a8665c098/requirements.txt \ | ||
&& pip install \ | ||
https://data.pyg.org/whl/torch-2.3.0%2Bcu121/torch_scatter-2.1.2%2Bpt23cu121-cp311-cp311-linux_x86_64.whl \ | ||
https://raw.githubusercontent.com/MrForExample/Comfy3D_Pre_Builds/b27af1a28d9f194cea1a137750e35ac698406e60/_Build_Wheels/_Wheels_linux_py311_cu121/diff_gaussian_rasterization-0.0.0-cp311-cp311-linux_x86_64.whl \ | ||
https://raw.githubusercontent.com/MrForExample/Comfy3D_Pre_Builds/b27af1a28d9f194cea1a137750e35ac698406e60/_Build_Wheels/_Wheels_linux_py311_cu121/kiui-0.2.10-py3-none-any.whl \ | ||
https://raw.githubusercontent.com/MrForExample/Comfy3D_Pre_Builds/b27af1a28d9f194cea1a137750e35ac698406e60/_Build_Wheels/_Wheels_linux_py311_cu121/nvdiffrast-0.3.1-py3-none-any.whl \ | ||
https://raw.githubusercontent.com/MrForExample/Comfy3D_Pre_Builds/b27af1a28d9f194cea1a137750e35ac698406e60/_Build_Wheels/_Wheels_linux_py311_cu121/pointnet2_ops-3.0.0-cp311-cp311-linux_x86_64.whl \ | ||
https://raw.githubusercontent.com/MrForExample/Comfy3D_Pre_Builds/b27af1a28d9f194cea1a137750e35ac698406e60/_Build_Wheels/_Wheels_linux_py311_cu121/pytorch3d-0.7.7-cp311-cp311-linux_x86_64.whl \ | ||
https://raw.githubusercontent.com/MrForExample/Comfy3D_Pre_Builds/b27af1a28d9f194cea1a137750e35ac698406e60/_Build_Wheels/_Wheels_linux_py311_cu121/simple_knn-0.0.0-cp311-cp311-linux_x86_64.whl \ | ||
&& pip list | ||
|
||
################################################################################ | ||
|
||
RUN du -ah /root \ | ||
&& rm -rf /root/* /root/.* | ||
|
||
COPY runner-scripts/. /runner-scripts/ | ||
|
||
USER root | ||
VOLUME /root | ||
WORKDIR /root | ||
EXPOSE 8188 | ||
ENV CLI_ARGS="" | ||
CMD ["bash","/runner-scripts/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
# Regex that matches REPO_NAME | ||
# First from pattern [https://example.com/xyz/REPO_NAME.git] or [git@example.com:xyz/REPO_NAME.git] | ||
# Second from pattern [http(s)://example.com/xyz/REPO_NAME] | ||
# They all extract REPO_NAME to BASH_REMATCH[2] | ||
function clone_or_pull () { | ||
if [[ $1 =~ ^(.*[/:])(.*)(\.git)$ ]] || [[ $1 =~ ^(http.*\/)(.*)$ ]]; then | ||
echo "${BASH_REMATCH[2]}" ; | ||
set +e ; | ||
git clone --depth=1 --no-tags --recurse-submodules --shallow-submodules "$1" \ | ||
|| git -C "${BASH_REMATCH[2]}" pull --ff-only ; | ||
set -e ; | ||
else | ||
echo "[ERROR] Invalid URL: $1" ; | ||
return 1 ; | ||
fi ; | ||
} | ||
|
||
|
||
echo "########################################" | ||
echo "[INFO] Downloading ComfyUI & Manager..." | ||
echo "########################################" | ||
|
||
cd /root | ||
clone_or_pull https://github.com/comfyanonymous/ComfyUI.git | ||
|
||
cd /root/ComfyUI/custom_nodes | ||
clone_or_pull https://github.com/ltdrdata/ComfyUI-Manager.git | ||
|
||
|
||
echo "########################################" | ||
echo "[INFO] Downloading Custom Nodes..." | ||
echo "########################################" | ||
|
||
cd /root/ComfyUI/custom_nodes | ||
|
||
clone_or_pull https://github.com/MrForExample/ComfyUI-3D-Pack.git | ||
git -C ComfyUI-3D-Pack reset --hard 30bc061d926f660e7f4822f54778df46326a8fec | ||
|
||
|
||
# Finish | ||
touch /root/.download-complete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Run user's set-proxy script | ||
cd /root | ||
if [ ! -f "/root/user-scripts/set-proxy.sh" ] ; then | ||
mkdir -p /root/user-scripts | ||
cp /runner-scripts/set-proxy.sh.example /root/user-scripts/set-proxy.sh | ||
else | ||
echo "[INFO] Running set-proxy script..." | ||
|
||
chmod +x /root/user-scripts/set-proxy.sh | ||
source /root/user-scripts/set-proxy.sh | ||
fi ; | ||
|
||
# Install ComfyUI | ||
cd /root | ||
if [ ! -f "/root/.download-complete" ] ; then | ||
chmod +x /runner-scripts/download.sh | ||
bash /runner-scripts/download.sh | ||
fi ; | ||
|
||
# Run user's pre-start script | ||
cd /root | ||
if [ ! -f "/root/user-scripts/pre-start.sh" ] ; then | ||
mkdir -p /root/user-scripts | ||
cp /runner-scripts/pre-start.sh.example /root/user-scripts/pre-start.sh | ||
else | ||
echo "[INFO] Running pre-start script..." | ||
|
||
chmod +x /root/user-scripts/pre-start.sh | ||
source /root/user-scripts/pre-start.sh | ||
fi ; | ||
|
||
|
||
echo "########################################" | ||
echo "[INFO] Starting ComfyUI..." | ||
echo "########################################" | ||
|
||
# Let .pyc files be stored in one place | ||
export PYTHONPYCACHEPREFIX="/root/.cache/pycache" | ||
# Let PIP install packages to /root/.local | ||
export PIP_USER=true | ||
# Add above to PATH | ||
export PATH="${PATH}:/root/.local/bin" | ||
# Suppress [WARNING: Running pip as the 'root' user] | ||
export PIP_ROOT_USER_ACTION=ignore | ||
|
||
cd /root | ||
|
||
python3 ./ComfyUI/main.py --listen --port 8188 ${CLI_ARGS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
echo "[INFO] Continue without pre-start script." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
# Tip: Within containers, you cannot access your host machine via 127.0.0.1. | ||
# You will need "host.docker.internal"(for Docker) or "host.containers.internal"(for Podman) | ||
|
||
# Example of setting proxy | ||
#export HTTP_PROXY=http://host.docker.internal:1081 | ||
#export HTTPS_PROXY=$HTTP_PROXY | ||
#export http_proxy=$HTTP_PROXY | ||
#export https_proxy=$HTTP_PROXY | ||
#export NO_PROXY="localhost,*.local,*.internal,[::1],fd00::/7, | ||
#10.0.0.0/8,127.0.0.0/8,169.254.0.0/16,172.16.0.0/12,192.168.0.0/16, | ||
#10.*,127.*,169.254.*,172.16.*,172.17.*,172.18.*,172.19.*,172.20.*, | ||
#172.21.*,172.22.*,172.23.*,172.24.*,172.25.*,172.26.*,172.27.*, | ||
#172.28.*,172.29.*,172.30.*,172.31.*,172.32.*,192.168.*, | ||
#*.cn,ghproxy.com,*.ghproxy.com,ghproxy.org,*.ghproxy.org, | ||
#gh-proxy.com,*.gh-proxy.com,ghproxy.net,*.ghproxy.net" | ||
#export no_proxy=$NO_PROXY | ||
#echo "[INFO] Proxy set to $HTTP_PROXY" | ||
|
||
echo "[INFO] Continue without proxy." |