Publish Gradio container images #28
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: Publish Gradio container images | |
on: | |
workflow_run: | |
workflows: [Publish Python container images based on Ubuntu] | |
types: | |
- completed | |
workflow_dispatch: | |
pull_request: | |
branches: [main] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{github.repository_owner}}/gradio | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
gradio: [3.28.3] | |
include: | |
- distro: python | |
codename: bullseye | |
- distro: ghcr.io/biscuittin/python | |
codename: 3.11-lunar | |
permissions: | |
packages: write | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
config-inline: | | |
[worker.oci] | |
max-parallelism = 1 | |
- name: Log into registry ${{env.REGISTRY}} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{env.REGISTRY}} | |
username: ${{github.actor}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{env.REGISTRY}}/${{env.IMAGE_NAME}} | |
tags: | | |
type=raw,${{matrix.gradio}}-${{matrix.distro}}-${{matrix.codename}} | |
labels: | | |
org.opencontainers.image.title=Gradio ${{matrix.gradio}} container image based on ${{matrix.distro}} ${{matrix.codename}} | |
org.opencontainers.image.description=Gradio ${{matrix.gradio}} container image based on ${{matrix.distro}} ${{matrix.codename}} | |
- name: Build and push Docker image from python | |
uses: docker/build-push-action@v5 | |
env: | |
PYPI_GRADIO_VERSION: ${{matrix.gradio}} | |
DISTRO: ${{matrix.distro}} | |
CODENAME: ${{matrix.codename}} | |
if: ${{matrix.distro == 'python'}} | |
with: | |
context: '{{defaultContext}}:gradio' | |
platforms: linux/amd64, linux/386, linux/arm64, linux/arm/v7, linux/arm/v5, linux/ppc64le, linux/s390x | |
push: ${{github.event_name != 'pull_request'}} | |
tags: ${{steps.meta.outputs.tags}} | |
labels: ${{steps.meta.outputs.labels}} | |
build-args: | | |
PYPI_GRADIO_VERSION | |
DISTRO | |
CODENAME | |
- name: Build and push Docker image from ghcr.io/biscuittin/python | |
uses: docker/build-push-action@v5 | |
env: | |
PYPI_GRADIO_VERSION: ${{matrix.gradio}} | |
DISTRO: ${{matrix.distro}} | |
CODENAME: ${{matrix.codename}} | |
if: ${{matrix.distro == 'ghcr.io/biscuittin/python'}} | |
with: | |
context: '{{defaultContext}}:gradio' | |
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le, linux/s390x | |
push: ${{github.event_name != 'pull_request'}} | |
tags: ${{steps.meta.outputs.tags}} | |
labels: ${{steps.meta.outputs.labels}} | |
build-args: | | |
PYPI_GRADIO_VERSION | |
DISTRO | |
CODENAME |