Skip to content

Commit

Permalink
feat: run the worker locally (#19)
Browse files Browse the repository at this point in the history
* feat: provide option to run the handler locally as API

* ci: run the workflow on our extended instance

* feat: the local API should run on 0.0.0.0

* ci: use semantic-release to create releases automatically
  • Loading branch information
TimPietrusky authored Feb 12, 2024
1 parent 1789028 commit 34eb32b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 15 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
dev:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-m
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -49,5 +49,3 @@ jobs:
push: true
tags: |
${{ secrets.DOCKERHUB_REPO }}/${{ secrets.DOCKERHUB_IMG }}:dev
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
name: CD | Release Docker Image
name: Release

on:
release:
types: [published]
workflow_dispatch:
push:
branches:
- "main"

jobs:
docker:
release:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }}
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -41,17 +49,34 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
- name: Update the ToC in the README.md
run: npx markdown-toc README.md -i

- name: Semantic release
uses: codfish/semantic-release-action@v3
id: semanticrelease
with:
additional-packages: |
['@semantic-release/git', '@semantic-release/changelog']
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build image and push it to Docker Hub
if: steps.semanticrelease.outputs.new-release-published == 'true'
uses: docker/build-push-action@v5
with:
push: true
tags: |
${{ secrets.DOCKERHUB_REPO }}/${{ secrets.DOCKERHUB_IMG }}:${{ github.event.release.tag_name }}
${{ secrets.DOCKERHUB_REPO }}/${{ secrets.DOCKERHUB_IMG }}:${{ steps.semanticrelease.outputs.release-version }}
${{ secrets.DOCKERHUB_REPO }}/${{ secrets.DOCKERHUB_IMG }}:latest
- name: Docker Hub Description
- name: Update description on Docker Hub
if: steps.semanticrelease.outputs.new-release-published == 'true'
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ secrets.DOCKERHUB_REPO }}/${{ secrets.DOCKERHUB_IMG }}



7 changes: 4 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ version: "3.8"

services:
comfyui:
image: timpietruskyblibla/runpod-worker-comfy:1.0.0
image: timpietruskyblibla/runpod-worker-comfy:latest
container_name: comfyui-worker
environment:
- NVIDIA_VISIBLE_DEVICES=all
env_file:
- .env
- SERVE_API_LOCALLY=true
ports:
- "8000:8000"
runtime: nvidia
volumes:
- ./data/comfyui/output:/comfyui/output
8 changes: 7 additions & 1 deletion src/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ echo "runpod-worker-comfy: Starting ComfyUI"
python3 /comfyui/main.py --disable-auto-launch --disable-metadata &

echo "runpod-worker-comfy: Starting RunPod Handler"
python3 -u /rp_handler.py

# Serve the API and don't shutdown the container
if [ "$SERVE_API_LOCALLY" == "true" ]; then
python3 -u /rp_handler.py --rp_serve_api --rp_api_host=0.0.0.0
else
python3 -u /rp_handler.py
fi

0 comments on commit 34eb32b

Please sign in to comment.