Skip to content

Docker files

Docker files #21

name: whisper-service CI
on:
push:
paths:
- whisper-service/**
branches:
- main
- staging
tags:
- "v*.*.*"
pull_request:
workflow_dispatch:
permissions:
actions: read
contents: read
env:
PYTHON_VERSION: 3.12
DOCKERHUB_ORG: 'scribear'
jobs:
test-whisper-service:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
working-directory: "whisper-service"
run: "pip install -r requirements.txt"
- name: Run tests
working-directory: "whisper-service"
run: pytest --cov=.
lint-whisper-service:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
working-directory: "whisper-service"
run: "pip install -r requirements.txt"
- name: Run tests
working-directory: "whisper-service"
run: pylint --disable=import-error $(git ls-files '*.py')
build-cpu-container-whisper-service:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKERHUB_ORG }}/whisper-service-cpu
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./whisper-service
file: ./whisper-service/Dockerfile_CPU
push: true
platforms: "linux/amd64,linux/arm64"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.DOCKERHUB_ORG }}/whisper-service-cpu:buildcache
cache-to: type=registry,ref=${{ env.DOCKERHUB_ORG }}/whisper-service-cpu:buildcache,mode=max
build-args: |
BRANCH=${{ steps.meta.outputs.version }}
BUILDNUMBER=${{ github.run_number }}
ARG GITSHA1=${{ github.sha }}
build-cuda-container-whisper-service:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKERHUB_ORG }}/whisper-service-cuda
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./whisper-service
file: ./whisper-service/Dockerfile_CUDA
push: true
platforms: "linux/amd64,linux/arm64"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.DOCKERHUB_ORG }}/whisper-service-cuda:buildcache
cache-to: type=registry,ref=${{ env.DOCKERHUB_ORG }}/whisper-service-cuda:buildcache,mode=max
build-args: |
BRANCH=${{ steps.meta.outputs.version }}
BUILDNUMBER=${{ github.run_number }}
ARG GITSHA1=${{ github.sha }}