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.
Merge pull request #1 from livepeer/feature/docker-builds
workflows: Automating docker image build pipeline
- Loading branch information
Showing
5 changed files
with
147 additions
and
73 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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
**/__pycache__ | ||
**/*.pyc | ||
**/*.pyo | ||
**/*.pyd | ||
.git | ||
**/*.py[cod] | ||
.env | ||
.venv | ||
.git/ | ||
.venv/ | ||
.github/ | ||
ui/node_modules/ | ||
.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,71 @@ | ||
name: Docker build and push images | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: docker builds | ||
permissions: | ||
packages: write | ||
contents: read | ||
runs-on: [self-hosted, linux, amd64] | ||
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: | | ||
${{ github.repository }} | ||
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 | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
file: docker/Dockerfile | ||
labels: ${{ steps.meta.outputs.labels }} | ||
annotations: ${{ steps.meta.outputs.annotations }} | ||
cache-from: type=registry,ref=${{ github.repository }}:build-cache | ||
cache-to: type=registry,mode=max,ref=${{ github.repository }}:build-cache | ||
|
||
- name: Notify new build upload | ||
run: curl -X POST https://holy-bread-207a.livepeer.workers.dev |
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,40 +1,41 @@ | ||
ARG BASE_IMAGE=livepeer/comfyui-base:latest | ||
FROM ${BASE_IMAGE} | ||
ARG BASE_IMAGE=livepeer/comfyui-base:latest | ||
|
||
RUN echo "Using base image: ${BASE_IMAGE}" | ||
FROM ${BASE_IMAGE} | ||
|
||
ENV PATH="/workspace/miniconda3/bin:${PATH}" | ||
EXPOSE 8188 | ||
EXPOSE 8889 | ||
EXPOSE 3000 | ||
EXPOSE 1024-65535/udp | ||
RUN apt-get update && apt-get install -y supervisor | ||
ENV PATH="/workspace/miniconda3/bin:${PATH}" \ | ||
NVM_DIR=/root/.nvm \ | ||
NODE_VERSION=18.18.0 | ||
|
||
WORKDIR / | ||
RUN echo "Using base image: ${BASE_IMAGE}" && \ | ||
apt update && \ | ||
apt install -yqq supervisor && \ | ||
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash | ||
|
||
# Install NVM | ||
ENV NVM_DIR=/root/.nvm | ||
ENV NODE_VERSION=18.18.0 | ||
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash | ||
WORKDIR / | ||
|
||
# Install node and npm | ||
RUN bash -c "source $NVM_DIR/nvm.sh \ | ||
&& nvm install $NODE_VERSION \ | ||
&& nvm alias default $NODE_VERSION \ | ||
&& nvm use default" | ||
RUN bash -c "source $NVM_DIR/nvm.sh && \ | ||
nvm install $NODE_VERSION && \ | ||
nvm alias default $NODE_VERSION && \ | ||
nvm use default" | ||
|
||
# Add node and npm to path so the commands are available | ||
ENV NODE_PATH=$NVM_DIR/v$NODE_VERSION/lib/node_modules | ||
ENV PATH=$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH | ||
RUN conda init bash | ||
ENV NODE_PATH="$NVM_DIR/v$NODE_VERSION/lib/node_modules" \ | ||
PATH="$NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH" | ||
|
||
# Create the supervisor configuration file for ComfyUI and ComfyStream | ||
RUN mkdir -p /etc/supervisor/conf.d | ||
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
RUN conda init bash | ||
|
||
WORKDIR /workspace/comfystream | ||
COPY docker/entrypoint.sh /workspace/comfystream/docker/entrypoint.sh | ||
RUN chmod +x /workspace/comfystream/docker/entrypoint.sh | ||
# Create the supervisor configuration file for ComfyUI and ComfyStream | ||
COPY docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
|
||
ENTRYPOINT ["/workspace/comfystream/docker/entrypoint.sh"] | ||
CMD ["/bin/bash"] | ||
WORKDIR /workspace/comfystream | ||
COPY --chmod=0755 docker/entrypoint.sh /workspace/comfystream/docker/entrypoint.sh | ||
|
||
EXPOSE 8188 | ||
EXPOSE 8889 | ||
EXPOSE 3000 | ||
EXPOSE 1024-65535/udp | ||
|
||
ENTRYPOINT [ "/workspace/comfystream/docker/entrypoint.sh" ] | ||
|
||
CMD [ "/bin/bash" ] |
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