Merge pull request #9 from jkremser/image-build #4
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
name: Build and push images for stable diffusion use-case | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
- '!samples/stable-diffusion/**' | |
- '!.github/**' | |
workflow_dispatch: | |
inputs: | |
imageTag: | |
description: "container image tag" | |
required: false | |
default: latest | |
type: string | |
workflow_call: | |
inputs: | |
imageTag: | |
description: "container image tag" | |
required: false | |
default: latest | |
type: string | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
CONTAINER_IMG_REGISTRY: ghcr.io | |
CONTAINER_IMG_ORG: kedify | |
CONTAINER_IMG_WORKER_NAME: stable-diffusion-worker | |
CONTAINER_IMG_WEBUI_NAME: stable-diffusion-webui | |
CONTAINER_IMG_TAG: ${{ inputs.imageTag || 'latest' }} | |
jobs: | |
build-container: | |
permissions: | |
contents: write | |
packages: write # push images | |
id-token: write # needed for signing the images with GitHub OIDC Token | |
name: build container | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
makefileTarget: [build-webui-image-multiarch, build-stable-diff-image-multiarch] | |
steps: | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
swap-size-mb: 2048 | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: kedify | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Install Cosign | |
uses: sigstore/cosign-installer@v3 | |
- name: Install Syft | |
uses: anchore/sbom-action@v0 | |
with: | |
format: 'spdx-json' | |
output-file: ${{ matrix.makefileTarget }}-${{ github.run_number }}-${{ github.run_attempt }}-'sbom.spdx.json' | |
- name: Build and push | |
env: | |
WORKER_IMAGE: "${{ env.CONTAINER_IMG_REGISTRY }}/${{ env.CONTAINER_IMG_ORG }}/${{ env.CONTAINER_IMG_WORKER_NAME }}:${{ env.CONTAINER_IMG_TAG }}" | |
WEBUI_IMAGE: "${{ env.CONTAINER_IMG_REGISTRY }}/${{ env.CONTAINER_IMG_ORG }}/${{ env.CONTAINER_IMG_WEBUI_NAME }}:${{ env.CONTAINER_IMG_TAG }}" | |
run: | | |
cd samples/stable-diffusion/ | |
make ${{ matrix.makefileTarget }} |