Fedir Zadniprovskyi 2024-06-03
ci: update how images are tagged, enable multi-arch builds
@7777c93fd2a5643a42fb67244a2307fb2daa8275
.github/workflows/docker-build-and-push.yaml
--- .github/workflows/docker-build-and-push.yaml
+++ .github/workflows/docker-build-and-push.yaml
@@ -8,6 +8,9 @@
   release:
     types: [published]
 
+env:
+  IMAGE_NAME: fedirz/faster-whisper-server
+
 jobs:
   docker:
     runs-on: ubuntu-22.04
@@ -21,23 +24,24 @@
             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 }}
-      - id: meta
-        uses: docker/metadata-action@v5
-        with:
-          images: |
-            fedirz/faster-whisper-server
-          # https://github.com/docker/metadata-action?tab=readme-ov-file#flavor-input
-          flavor: |
-            latest=false
-            suffix=${{ matrix.tag-suffix}}
-          tags: |
-            type=semver,pattern={{version}}
-            type=semver,pattern={{major}}.{{minor}}
       - name: Set up Docker Buildx
         uses: docker/setup-buildx-action@v3
       - name: Build and push
@@ -46,8 +50,7 @@
           context: .
           file: ${{ matrix.dockerfile }}
           push: true
-          # TODO:
-          # platforms: linux/amd64,linux/arm64
+          platforms: linux/amd64,linux/arm64
           tags: ${{ steps.meta.outputs.tags }}
-          cache-from: type=registry,ref=fedirz/faster-whisper-server:buildcache
-          cache-to: type=registry,ref=fedirz/faster-whisper-server:buildcache,mode=max
+          cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
+          cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max
Taskfile.yaml
--- Taskfile.yaml
+++ Taskfile.yaml
@@ -20,6 +20,9 @@
       - Dockerfile.*
       - faster_whisper_server/*.py
   sync: lsyncd lsyncd.conf
+  cii:
+    cmds:
+      - act --rm --action-offline-mode --secret-file .secrets {{.CLI_ARGS}}
   # Python's urllib3 takes forever when ipv6 is enabled
   # https://support.nordvpn.com/hc/en-us/articles/20164669224337-How-to-disable-IPv6-on-Linux
   disable-ipv6: sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 && sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
Add a comment
List