|
| 1 | +name: Build and push comfyui-base docker image |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - docker/Dockerfile.base |
| 7 | + - src/comfystream/scripts/ |
| 8 | + - configs/ |
| 9 | + - .github/workflows/comfyui-base.yaml |
| 10 | + branches: |
| 11 | + - main |
| 12 | + push: |
| 13 | + paths: |
| 14 | + - docker/Dockerfile.base |
| 15 | + - src/comfystream/scripts/ |
| 16 | + - configs/ |
| 17 | + - .github/workflows/comfyui-base.yaml |
| 18 | + branches: |
| 19 | + - main |
| 20 | + tags: |
| 21 | + - "v*" |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + docker: |
| 29 | + name: docker builds |
| 30 | + if: ${{ github.repository == 'livepeer/comfystream' }} |
| 31 | + permissions: |
| 32 | + packages: write |
| 33 | + contents: read |
| 34 | + runs-on: [self-hosted, linux, gpu] |
| 35 | + steps: |
| 36 | + - name: Check out code |
| 37 | + uses: actions/checkout@v4 |
| 38 | + with: |
| 39 | + fetch-depth: 0 |
| 40 | + ref: ${{ github.event.pull_request.head.sha }} |
| 41 | + |
| 42 | + - name: Login to DockerHub |
| 43 | + uses: docker/login-action@v3 |
| 44 | + with: |
| 45 | + username: ${{ secrets.CI_DOCKERHUB_USERNAME }} |
| 46 | + password: ${{ secrets.CI_DOCKERHUB_TOKEN }} |
| 47 | + |
| 48 | + - name: Extract metadata (tags, labels) for Docker |
| 49 | + id: meta |
| 50 | + uses: docker/metadata-action@v5 |
| 51 | + with: |
| 52 | + images: | |
| 53 | + livepeer/comfyui-base |
| 54 | + tags: | |
| 55 | + type=sha |
| 56 | + type=ref,event=pr |
| 57 | + type=ref,event=tag |
| 58 | + type=sha,format=long |
| 59 | + type=ref,event=branch |
| 60 | + type=semver,pattern={{version}},prefix=v |
| 61 | + type=semver,pattern={{major}}.{{minor}},prefix=v |
| 62 | + type=raw,value=latest,enable={{is_default_branch}} |
| 63 | + type=raw,value=${{ github.event.pull_request.head.ref }} |
| 64 | + type=raw,value=stable,enable=${{ startsWith(github.event.ref, 'refs/tags/v') }} |
| 65 | +
|
| 66 | + - name: Set up Docker Buildx |
| 67 | + uses: docker/setup-buildx-action@v3 |
| 68 | + |
| 69 | + - name: Build and push livepeer docker image |
| 70 | + timeout-minutes: 200 |
| 71 | + uses: docker/build-push-action@v6 |
| 72 | + with: |
| 73 | + context: . |
| 74 | + provenance: mode=max |
| 75 | + sbom: true |
| 76 | + push: true |
| 77 | + tags: ${{ steps.meta.outputs.tags }} |
| 78 | + file: docker/Dockerfile.base |
| 79 | + labels: ${{ steps.meta.outputs.labels }} |
| 80 | + annotations: ${{ steps.meta.outputs.annotations }} |
| 81 | + cache-from: type=registry,ref=livepeer/comfyui-base:build-cache |
| 82 | + cache-to: type=registry,mode=max,ref=livepeer/comfyui-base:build-cache |
0 commit comments