Skip to content

Commit

Permalink
chore: update docker workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
veralvx committed Feb 21, 2025
1 parent 1adf27b commit 026debb
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,35 @@ name: Push to Registries
on:
push:
tags: ['*']

workflow_dispatch:


jobs:
push-latest:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
strategy:
matrix:
include:
- dockerfile: Dockerfile.cli
- dockerfile: Dockerfile.cli
suffix: cli
- dockerfile: Dockerfile.gradio
- dockerfile: Dockerfile.gradio
suffix: gradio
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{ github.repository_owner }}/${{ github.event.repository.name }}
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}
# generate Docker tags based on the following events/attributes
tags: |
type=semver,pattern={{version}}
- name: Login to Docker Hub
uses: docker/#-action@v3
Expand All @@ -43,12 +46,21 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image with specified suffix
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ matrix.suffix }}
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ matrix.suffix }}
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ matrix.suffix != '' && format('{0}-{1}', matrix.suffix, steps.meta.outputs.version) || steps.meta.outputs.version }}
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ matrix.suffix != '' && format('{0}-latest', matrix.suffix) || 'latest' }}
${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ matrix.suffix != '' && format('{0}-{1}', matrix.suffix, steps.meta.outputs.version) || steps.meta.outputs.version }}
${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ matrix.suffix != '' && format('{0}-latest', matrix.suffix) || 'latest' }}

0 comments on commit 026debb

Please # to comment.