-
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.
Initial commit for ComfyUI Runpod worker
- Loading branch information
0 parents
commit 1daaaf0
Showing
16 changed files
with
1,306 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,11 @@ | ||
*.git | ||
*.gitignore | ||
|
||
env/ | ||
.env | ||
|
||
__pycache__ | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
.Python |
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,55 @@ | ||
name: Docker Build and Push Container | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# TODO: Enable this step if not using network volume | ||
# - name: Free disk space | ||
# run: | | ||
# df -h | ||
# sudo rm -rf /usr/share/dotnet | ||
# sudo rm -rf /usr/local/lib/android | ||
# sudo rm -rf /opt/ghc | ||
# sudo rm -rf /opt/hostedtoolcache | ||
# df -h | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
|
||
- name: Generate version number | ||
id: version | ||
run: | | ||
echo "VERSION=v1.0.${{ github.run_number }}" >> $GITHUB_OUTPUT | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
driver: docker-container | ||
buildkitd-flags: --debug | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build container and push to Docker Hub | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO_NAME }}:latest | ||
${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO_NAME }}:${{ steps.version.outputs.VERSION }} | ||
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO_NAME }}:buildcache | ||
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO_NAME }}:buildcache,mode=max | ||
platforms: linux/amd64 |
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,11 @@ | ||
# git ignore | ||
|
||
# system | ||
.DS_Store | ||
|
||
# python | ||
venv | ||
__pycache__ | ||
|
||
# env | ||
.env |
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,64 @@ | ||
# dockerfile | ||
|
||
FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04 | ||
|
||
WORKDIR / | ||
|
||
# Set environment variables | ||
ENV DEBIAN_FRONTEND=noninteractive \ | ||
PIP_PREFER_BINARY=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
CUDA_HOME=/usr/local/cuda \ | ||
PATH=/usr/local/cuda/bin:/opt/venv/bin:$PATH \ | ||
ENVIRONMENT=PRODUCTION \ | ||
COMFYUI_ROOT=/comfyui | ||
|
||
# Install Python, system dependencies, and CUDA | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
bash \ | ||
git \ | ||
python3.10.16 \ | ||
python3.10.16-venv \ | ||
python3-pip \ | ||
libgl1 \ | ||
libglib2.0-0 \ | ||
wget && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Create virtual environment for Python and install requirements | ||
RUN python3.10 -m venv /opt/venv && \ | ||
/opt/venv/bin/pip install --upgrade pip | ||
|
||
# Copy the Python dependencies (requirements.txt) and install | ||
RUN /opt/venv/bin/pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 | ||
|
||
# Clone ComfyUI and install its dependencies | ||
RUN git clone https://github.com/comfyanonymous/ComfyUI.git ${COMFYUI_ROOT} && \ | ||
cd ${COMFYUI_ROOT} && \ | ||
/opt/venv/bin/pip install --no-cache-dir -r requirements.txt | ||
|
||
|
||
# download models | ||
# SD Classic 1.5 | ||
# RUN wget --show-progress --progress=dot:giga -O /comfyui/models/checkpoints/v1-5-pruned-emaonly.safetensors https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors | ||
# SDXL Lightning 4-step | ||
# RUN wget --show-progress --progress=dot:giga -O /comfyui/models/checkpoints/sdxl_lightning_4step.safetensors https://huggingface.co/ByteDance/SDXL-Lightning/resolve/main/sdxl_lightning_4step.safetensors | ||
# SDXL Lightning 8-step | ||
# RUN wget --show-progress --progress=dot:giga -O /comfyui/models/checkpoints/sdxl_lightning_8step.safetensors https://huggingface.co/ByteDance/SDXL-Lightning/resolve/main/sdxl_lightning_8step.safetensors | ||
# Juggernaut XL Lightning, Version XI | ||
# RUN wget --show-progress --progress=dot:giga -O /comfyui/models/checkpoints/juggernautXL_juggXILightningByRD.safetensors https://civitai.com/api/download/models/920957?type=Model&format=SafeTensor&size=full&fp=fp16 | ||
# TODO: Add your models here if not using network volume | ||
|
||
|
||
# Copy the Python dependencies (requirements.txt) and install | ||
COPY requirements.txt /requirements.txt | ||
RUN /opt/venv/bin/pip install --no-cache-dir -r /requirements.txt | ||
|
||
# Copy application code | ||
RUN mkdir -p /app | ||
COPY src/ /app/ | ||
RUN chmod +x /app/main.sh | ||
|
||
# Set the final command | ||
CMD ["/app/main.sh"] |
Oops, something went wrong.