forked from yondonfu/comfystream
-
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.
docker: Add workflow for building comfyui-base images
- Loading branch information
1 parent
258afb8
commit e8ba912
Showing
5 changed files
with
167 additions
and
59 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 |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
.git/ | ||
.venv/ | ||
.github/ | ||
ui/node_modules/ | ||
ui/ | ||
.dockerignore |
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,79 @@ | ||
name: Build and push comfyui-base docker image | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- docker/Dockerfile.base | ||
- src/comfystream/scripts/ | ||
- configs/ | ||
- .github/workflows/comfyui-base.yaml | ||
branches: | ||
- main | ||
push: | ||
paths: | ||
- docker/Dockerfile.base | ||
- src/comfystream/scripts/ | ||
- configs/ | ||
- .github/workflows/comfyui-base.yaml | ||
branches: | ||
- main | ||
tags: | ||
- "v*" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
docker: | ||
name: docker builds | ||
permissions: | ||
packages: write | ||
contents: read | ||
runs-on: [self-hosted, linux, gpu] | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.CI_DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.CI_DOCKERHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
livepeer/comfyui-base | ||
tags: | | ||
type=sha | ||
type=ref,event=pr | ||
type=ref,event=tag | ||
type=sha,format=long | ||
type=ref,event=branch | ||
type=semver,pattern={{version}},prefix=v | ||
type=semver,pattern={{major}}.{{minor}},prefix=v | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
type=raw,value=${{ github.event.pull_request.head.ref }} | ||
type=raw,value=stable,enable=${{ startsWith(github.event.ref, 'refs/tags/v') }} | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and push livepeer docker image | ||
timeout-minutes: 200 | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
file: docker/Dockerfile.base | ||
labels: ${{ steps.meta.outputs.labels }} | ||
annotations: ${{ steps.meta.outputs.annotations }} | ||
cache-from: type=registry,ref=livepeer/comfyui-base:build-cache | ||
cache-to: type=registry,mode=max,ref=livepeer/comfyui-base:build-cache |
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
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 |
---|---|---|
@@ -1,58 +1,66 @@ | ||
ARG BASE_IMAGE=nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04 | ||
FROM ${BASE_IMAGE} | ||
ARG BASE_IMAGE=nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04 \ | ||
CONDA_VERSION=latest \ | ||
PYTHON_VERSION=3.11 | ||
|
||
FROM "${BASE_IMAGE}" | ||
|
||
ARG CONDA_VERSION \ | ||
PYTHON_VERSION | ||
|
||
|
||
ENV DEBIAN_FRONTEND=noninteractive \ | ||
CONDA_VERSION="${CONDA_VERSION}" \ | ||
PATH="/workspace/miniconda3/bin:${PATH}" \ | ||
PYTHON_VERSION="${PYTHON_VERSION}" | ||
|
||
# System dependencies | ||
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y \ | ||
git \ | ||
wget \ | ||
nano \ | ||
socat \ | ||
libsndfile1 \ | ||
build-essential llvm tk-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN apt update && apt install -yqq \ | ||
git \ | ||
wget \ | ||
nano \ | ||
socat \ | ||
libsndfile1 \ | ||
build-essential llvm tk-dev && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Conda setup | ||
RUN mkdir -p /workspace/comfystream | ||
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh \ | ||
&& bash /tmp/miniconda.sh -b -p /workspace/miniconda3 \ | ||
&& rm /tmp/miniconda.sh | ||
|
||
ENV PATH="/workspace/miniconda3/bin:${PATH}" | ||
RUN eval "$(/workspace/miniconda3/bin/conda shell.bash hook)" | ||
RUN conda create -n comfystream python=3.11 -y | ||
RUN mkdir -p /workspace/comfystream && \ | ||
wget "https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh" -O /tmp/miniconda.sh && \ | ||
bash /tmp/miniconda.sh -b -p /workspace/miniconda3 && \ | ||
eval "$(/workspace/miniconda3/bin/conda shell.bash hook)" && \ | ||
conda create -n comfystream python="${PYTHON_VERSION}" -y && \ | ||
rm /tmp/miniconda.sh && \ | ||
conda run -n comfystream --no-capture-output pip install aiortc aiohttp requests tqdm pyyaml --root-user-action=ignore | ||
|
||
# Clone ComfyUI | ||
RUN git clone https://github.com/comfyanonymous/ComfyUI.git /workspace/ComfyUI | ||
ADD --link https://github.com/comfyanonymous/ComfyUI.git /workspace/ComfyUI | ||
|
||
# Copy only files needed for setup | ||
COPY ./src/comfystream/scripts /workspace/comfystream/src/comfystream/scripts | ||
COPY ./configs /workspace/comfystream/configs | ||
|
||
# Install base dependencies | ||
RUN conda run -n comfystream --no-capture-output pip install aiortc aiohttp requests tqdm pyyaml --root-user-action=ignore | ||
COPY --link ./src/comfystream/scripts /workspace/comfystream/src/comfystream/scripts | ||
COPY --link ./configs /workspace/comfystream/configs | ||
|
||
# Run setup_nodes (cached unless setup_nodes.py or nodes/ changes) | ||
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream python src/comfystream/scripts/setup_nodes.py --workspace /workspace/ComfyUI | ||
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream python src/comfystream/scripts/setup_nodes.py --workspace /workspace/ComfyUI | ||
|
||
# Copy ComfyStream files into ComfyUI | ||
COPY . /workspace/comfystream | ||
COPY . /workspace/comfystream | ||
|
||
# Copy comfystream and example workflows to ComfyUI | ||
COPY ./workflows/comfyui/* /workspace/ComfyUI/user/default/workflows | ||
COPY ./workflows/comfyui/* /workspace/ComfyUI/user/default/workflows | ||
|
||
# Install ComfyUI requirements | ||
RUN conda run -n comfystream --no-capture-output --cwd /workspace/ComfyUI pip install -r requirements.txt --root-user-action=ignore | ||
RUN conda run -n comfystream --no-capture-output --cwd /workspace/ComfyUI pip install -r requirements.txt --root-user-action=ignore | ||
|
||
# Install ComfyStream requirements | ||
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream pip install -r requirements.txt --root-user-action=ignore | ||
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream pip install . --root-user-action=ignore | ||
RUN ln -s /workspace/comfystream /workspace/ComfyUI/custom_nodes/comfystream | ||
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream python install.py --workspace /workspace/ComfyUI | ||
RUN conda run -n comfystream --no-capture-output pip install --upgrade tensorrt-cu12-bindings tensorrt-cu12-libs --root-user-action=ignore | ||
RUN conda run -n comfystream --no-capture-output pip install mediapipe==0.10.8 --root-user-action=ignore | ||
RUN conda run -n comfystream --no-capture-output --cwd /workspace/comfystream pip install -r requirements.txt --root-user-action=ignore && \ | ||
conda run -n comfystream --no-capture-output --cwd /workspace/comfystream pip install . --root-user-action=ignore && \ | ||
ln -s /workspace/comfystream /workspace/ComfyUI/custom_nodes/comfystream && \ | ||
conda run -n comfystream --no-capture-output --cwd /workspace/comfystream python install.py --workspace /workspace/ComfyUI && \ | ||
conda run -n comfystream --no-capture-output pip install --upgrade tensorrt-cu12-bindings tensorrt-cu12-libs --root-user-action=ignore && \ | ||
conda run -n comfystream --no-capture-output pip install mediapipe==0.10.8 --root-user-action=ignore | ||
|
||
# Configure no environment activation by default | ||
RUN conda config --set auto_activate_base false | ||
RUN conda init bash | ||
RUN conda config --set auto_activate_base false && \ | ||
conda init bash | ||
|
||
WORKDIR /workspace/comfystream | ||
WORKDIR /workspace/comfystream |
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