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 Docker Image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
- 'main' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- 'master' | |
- 'main' | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 1 | |
matrix: | |
config: | |
- { tag: "whisper-base", dockerfile: "whisper/Dockerfile", context: "whisper"} | |
- { tag: "whisper-base-cuda-11-8", dockerfile: "whisper/Dockerfile.cuda", context: "whisper"} | |
steps: | |
- name: Clone | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GHCR (GitHub Packages) | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tool-cache: true | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: false | |
swap-storage: true | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/bnosac/${{ matrix.config.tag }} | |
tags: | | |
# set latest tag for default branch | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=semver,pattern={{version}} | |
- name: Build and push ghcr.io | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ matrix.config.context }} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
file: ${{ matrix.config.dockerfile }} | |
build-args: | | |
WHISPER_MODEL=medium |