File size: 1,824 Bytes
aa5390b
 
56b662d
aa5390b
56b662d
 
6e8a2c4
 
760dfe6
 
aa5390b
 
e54c9d1
aa5390b
 
8fc9285
cbe5417
aa5390b
cbe5417
47627a9
8fc9285
47627a9
aa5390b
 
 
 
 
 
760dfe6
aa5390b
 
760dfe6
aa5390b
760dfe6
56b662d
760dfe6
 
 
 
 
 
 
aa5390b
 
 
de92535
aa5390b
 
8fc9285
 
 
56b662d
760dfe6
aa5390b
760dfe6
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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-latest
    strategy:
      matrix:
        # https://hub.docker.com/r/nvidia/cuda/tags
        base-image: ['nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04', 'ubuntu:24.04']
        include:
          - base-image: nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04
            tag-suffix: -cuda
          - base-image: ubuntu:24.04
            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@v6
        with:
          context: .
          file: Dockerfile
          build-args: |
            BASE_IMAGE=${{ matrix.base-image }}
          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