Spaces:
Configuration error
Configuration error
name: docker-build-and-push | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- 'v*' | |
release: | |
types: [published] | |
env: | |
IMAGE_NAME: fedirz/faster-whisper-server | |
jobs: | |
docker: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
dockerfile: [Dockerfile.cuda, Dockerfile.cpu] | |
include: | |
- dockerfile: Dockerfile.cuda | |
tag-suffix: -cuda | |
- dockerfile: Dockerfile.cpu | |
tag-suffix: -cpu | |
steps: | |
- uses: actions/checkout@v4 | |
- id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.IMAGE_NAME }} | |
# https://github.com/docker/metadata-action?tab=readme-ov-file#flavor-input | |
flavor: | | |
suffix=${{ matrix.tag-suffix}},onlatest=true | |
tags: | | |
type=semver,pattern={{major}}.{{minor}}.{{patch}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ${{ matrix.dockerfile }} | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache | |
cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max | |