Skip to content

Commit

Permalink
changed to pudh
Browse files Browse the repository at this point in the history
  • Loading branch information
arunbluez committed Dec 6, 2024
1 parent e7a9377 commit eaab1c9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 181 deletions.
88 changes: 12 additions & 76 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,24 @@
name: Release

on:
workflow_dispatch:
push:
branches:
- "main"

branches: ["main"]
jobs:
release:
build-and-push:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }}
permissions:
contents: write
issues: write
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: pip install -r requirements.txt

- name: Clear space to remove unused folders
run: |
rm -rf /usr/share/dotnet
rm -rf /opt/ghc
rm -rf "/usr/local/share/boost"
rm -rf "$AGENT_TOOLSDIRECTORY"
- 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
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- 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', '@semantic-release/exec']
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Set environment variables
if: steps.semanticrelease.outputs.new-release-published == 'true'
run: |
echo "DOCKERHUB_REPO=${{ vars.DOCKERHUB_REPO }}" >> $GITHUB_ENV
echo "DOCKERHUB_IMG=${{ vars.DOCKERHUB_IMG }}" >> $GITHUB_ENV
echo "HUGGINGFACE_ACCESS_TOKEN=${{ secrets.HUGGINGFACE_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "RELEASE_VERSION=${{ steps.semanticrelease.outputs.release-version }}" >> $GITHUB_ENV
- name: Build and push the images to Docker Hub
if: steps.semanticrelease.outputs.new-release-published == 'true'
uses: docker/bake-action@v2
- uses: docker/build-push-action@v5
with:
push: true
set: |
*.args.DOCKERHUB_REPO=${{ env.DOCKERHUB_REPO }}
*.args.DOCKERHUB_IMG=${{ env.DOCKERHUB_IMG }}
*.args.RELEASE_VERSION=${{ env.RELEASE_VERSION }}
*.args.HUGGINGFACE_ACCESS_TOKEN=${{ env.HUGGINGFACE_ACCESS_TOKEN }}
- 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: ${{ env.DOCKERHUB_REPO }}/${{ env.DOCKERHUB_IMG }}
platforms: linux/amd64
build-args: |
HUGGINGFACE_ACCESS_TOKEN=${{ secrets.HUGGINGFACE_ACCESS_TOKEN }}
tags: |
blacktailai/blacktail-comfyui-worker:latest
95 changes: 28 additions & 67 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,84 +1,45 @@
# Stage 1: Base image with common dependencies
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 as base
# Base image only
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04

# Prevents prompts from packages asking for user input during installation
ENV DEBIAN_FRONTEND=noninteractive
# Prefer binary wheels over source distributions for faster pip installations
ENV PIP_PREFER_BINARY=1
# Ensures output from python is printed immediately to the terminal without buffering
ENV PYTHONUNBUFFERED=1
# Speed up some cmake builds
ENV CMAKE_BUILD_PARALLEL_LEVEL=8
ENV DEBIAN_FRONTEND=noninteractive \
PIP_PREFER_BINARY=1 \
PYTHONUNBUFFERED=1 \
CMAKE_BUILD_PARALLEL_LEVEL=8

# Install Python, git and other necessary tools
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
git \
wget \
libgl1 \
python3.10 python3-pip git wget libgl1 \
&& ln -sf /usr/bin/python3.10 /usr/bin/python \
&& ln -sf /usr/bin/pip3 /usr/bin/pip
&& ln -sf /usr/bin/pip3 /usr/bin/pip \
&& apt-get autoremove -y && apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Clean up to reduce image size
RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/*
RUN pip install comfy-cli runpod requests && \
/usr/bin/yes | comfy --workspace /comfyui install --cuda-version 11.8 --nvidia --version 0.2.7

# Install comfy-cli
RUN pip install comfy-cli

# Install ComfyUI
RUN /usr/bin/yes | comfy --workspace /comfyui install --cuda-version 11.7 --nvidia --version 0.2.7

# Change working directory to ComfyUI
WORKDIR /comfyui

# Install runpod
RUN pip install runpod requests
# Create directories and download models
RUN mkdir -p models/{unet,clip,vae} && \
wget -O models/clip/clip_l.safetensors \
https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors && \
wget -O models/clip/t5xxl_fp8_e4m3fn.safetensors \
https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors

# Support for the network volume
ADD src/extra_model_paths.yaml ./

# Go back to the root
ARG HUGGINGFACE_ACCESS_TOKEN
RUN wget --header="Authorization: Bearer ${HUGGINGFACE_ACCESS_TOKEN}" \
-O models/unet/flux1-dev.safetensors \
https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/flux1-dev.safetensors && \
wget --header="Authorization: Bearer ${HUGGINGFACE_ACCESS_TOKEN}" \
-O models/vae/ae.safetensors \
https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.safetensors

# Add configuration and scripts
WORKDIR /

# Add scripts
ADD src/extra_model_paths.yaml /comfyui/
ADD src/start.sh src/restore_snapshot.sh src/rp_handler.py test_input.json ./
RUN chmod +x /start.sh /restore_snapshot.sh

# Optionally copy the snapshot file
ADD *snapshot*.json /

# Restore the snapshot to install custom nodes
RUN /restore_snapshot.sh

# Start container
CMD ["/start.sh"]

# Stage 2: Download models
FROM base as downloader

ARG HUGGINGFACE_ACCESS_TOKEN
ARG MODEL_TYPE

# Change working directory to ComfyUI
WORKDIR /comfyui

# Create necessary directories
RUN mkdir -p models/checkpoints models/vae

# Download checkpoints/vae/LoRA to include in image based on model type
RUN if [ "$MODEL_TYPE" = "flux1-dev" ]; then \
wget --header="Authorization: Bearer ${HUGGINGFACE_ACCESS_TOKEN}" -O models/unet/flux1-dev.safetensors https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/flux1-dev.safetensors && \
wget -O models/clip/clip_l.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors && \
wget -O models/clip/t5xxl_fp8_e4m3fn.safetensors https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors && \
wget --header="Authorization: Bearer ${HUGGINGFACE_ACCESS_TOKEN}" -O models/vae/ae.safetensors https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.safetensors; \
fi

# Stage 3: Final image
FROM base as final

# Copy models from stage 2 to the final image
COPY --from=downloader /comfyui/models /comfyui/models

# Start container
CMD ["/start.sh"]
38 changes: 0 additions & 38 deletions docker-bake.hcl

This file was deleted.

0 comments on commit eaab1c9

Please sign in to comment.