Skip to content

Commit

Permalink
client-node_cog-comfyui
Browse files Browse the repository at this point in the history
  • Loading branch information
vvauijij committed Apr 14, 2024
1 parent 1cfa149 commit 834dacc
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 76 deletions.
131 changes: 79 additions & 52 deletions .github/workflows/publish-images.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
name: Publish client-node Docker Images to ghcr.io
name: Publish Images

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
branches: ["main"]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

AIDOCK_COMFYUI_DOCKERFILE: build/client-node-inference.dockerfile
AIDOCK_TAG: -aidock-comfyui
AIDOCK_COMFYUI_IMAGE: ghcr.io/ai-dock/comfyui
AIDOCK_COMFYUI_TAG: pytorch-2.2.0-py3.10-cuda-11.8.0-runtime-22.04

COG_COMFYUI_DOCKERFILE: build/client-node-inference.dockerfile
COG_TAG: -cog-comfyui
COG_COMFYUI_IMAGE: ghcr.io/paipe-labs/cog-comfyui
COG_COMFYUI_TAG: latest

jobs:
cog-comfyui:
client-node-aidock-comfyui:
runs-on: ubuntu-latest

# `GITHUB_TOKEN` permissions for the actions in this job
Expand All @@ -30,61 +40,78 @@ jobs:
sudo rm -rf /usr/local/lib/android
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Checkout cog-comfyui
- name: Checkout Repository
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}${{ env.AIDOCK_TAG }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
repository: fofr/cog-comfyui
submodules: true
- name: Clone Plugins
run: ./scripts/clone_plugins.sh
context: .
file: ${{ env.AIDOCK_COMFYUI_DOCKERFILE }}
build-args: |
INFERENCE_IMAGE=${{ env.AIDOCK_COMFYUI_IMAGE }}
INFERENCE_TAG=${{ env.AIDOCK_COMFYUI_TAG }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

client-node-cog-comfyui:
runs-on: ubuntu-latest

# `GITHUB_TOKEN` permissions for the actions in this job
permissions:
contents: read
packages: write

steps:
- name: Free Space
run: |
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/local/share/boost
sudo rm -rf /usr/local/lib/android
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Checkout Repository
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Cog
uses: replicate/setup-cog@v1

- name: Extract Metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}${{ env.COG_TAG }}

- name: Build and Push Docker Image
run: cog push ghcr.io/paipe-labs/cog-comfyui

# client-node-comfyui:
# runs-on: ubuntu-latest

# # `GITHUB_TOKEN` permissions for the actions in this job
# permissions:
# contents: read
# packages: write

# steps:
# - name: Free Space
# run: |
# df -h
# sudo rm -rf /usr/share/dotnet
# sudo rm -rf /opt/ghc
# sudo rm -rf /usr/local/.ghcup
# sudo rm -rf /usr/local/share/boost
# sudo rm -rf /usr/local/lib/android
# sudo rm -rf "$AGENT_TOOLSDIRECTORY"
# df -h
# - name: Checkout
# uses: actions/checkout@v4
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Extract Metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# - name: Build and Push Docker Image
# uses: docker/build-push-action@v5
# with:
# context: .
# file: client-node-comfyui.dockerfile
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
uses: docker/build-push-action@v5
with:
context: .
file: ${{ env.COG_COMFYUI_DOCKERFILE }}
build-args: |
INFERENCE_IMAGE=${{ env.COG_COMFYUI_IMAGE }}
INFERENCE_TAG=${{ env.COG_COMFYUI_TAG }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
42 changes: 42 additions & 0 deletions build/client-node-inference.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ARG INFERENCE_IMAGE
ARG INFERENCE_TAG

FROM ${INFERENCE_IMAGE}:${INFERENCE_TAG}


################################## install curl & jq ####################################
RUN apt-get update \
&& apt install -y curl \
&& apt install -y jq


############################### install node & npm & yarn ###############################
ENV NODE_VERSION=20.9.0
ENV NVM_DIR=/root/.nvm
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
RUN npm install -g yarn


###################################### build node #######################################
WORKDIR /genai-node

COPY client-package/package.json .
COPY client-package/yarn.lock .
RUN yarn install

# dirty hack to make node-sd-webui work with our imports,
# remove when we replace library node-sd-webui
RUN jq '. + { "type": "module" }' node_modules/node-sd-webui/package.json > temp.json \
&& mv temp.json node_modules/node-sd-webui/package.json

COPY client-package .
RUN yarn build


################################## configure inference ##################################
COPY build .
29 changes: 6 additions & 23 deletions build/client-node.dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
ARG INFERENCE_IMAGE
ARG INFERENCE_TAG
FROM node:20-alpine3.18

FROM ${INFERENCE_IMAGE}:${INFERENCE_TAG}


################################## install curl & jq ####################################
RUN apt-get update \
&& apt install -y curl \
&& apt install -y jq


############################### install node & npm & yarn ###############################
ENV NODE_VERSION=20.9.0
ENV NVM_DIR=/root/.nvm
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
RUN npm install -g yarn
###################################### install jq #######################################
RUN apk update && apk add jq


###################################### build node #######################################
Expand All @@ -32,11 +15,11 @@ RUN yarn install
# dirty hack to make node-sd-webui work with our imports,
# remove when we replace library node-sd-webui
RUN jq '. + { "type": "module" }' node_modules/node-sd-webui/package.json > temp.json \
&& mv temp.json node_modules/node-sd-webui/package.json
&& mv temp.json node_modules/node-sd-webui/package.json

COPY client-package .
RUN yarn build


################################### configure comfyUI ###################################
COPY build .
####################################### run node ########################################
ENTRYPOINT node public/run.js
1 change: 0 additions & 1 deletion build/cog-comfyui/run_comfyui.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/bash

python cog-comfyui/get_weights.py
python /src/ComfyUI/main.py

0 comments on commit 834dacc

Please sign in to comment.