From 6cabbe441b4a3301ca1609446ce95b0c4befa344 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Fri, 16 Feb 2024 18:58:38 +0530 Subject: [PATCH 01/11] update cpu dockerfile with python-slim-buster base image --- docker/Dockerfile.cpu | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/docker/Dockerfile.cpu b/docker/Dockerfile.cpu index d1958cfe..69d57d12 100644 --- a/docker/Dockerfile.cpu +++ b/docker/Dockerfile.cpu @@ -1,45 +1,24 @@ -FROM ubuntu:focal +FROM python:3.8-slim-buster ARG DEBIAN_FRONTEND=noninteractive -# Remove any third-party apt sources to avoid issues with expiring keys. -RUN rm -f /etc/apt/sources.list.d/*.list - -# Install some basic utilities. -RUN apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ sudo \ git \ bzip2 \ libx11-6 \ + && apt-get clean \ && rm -rf /var/lib/apt/lists/* -RUN apt update - -# install python -RUN apt install software-properties-common -y && \ - add-apt-repository ppa:deadsnakes/ppa && \ - apt update - -RUN apt install python3-dev -y && \ - apt install python-is-python3 - - -# install pip -RUN apt install python3-pip -y - -# Create a working directory. -RUN mkdir /app WORKDIR /app -COPY scripts/setup.sh /app -COPY requirements/ /app +COPY scripts/setup.sh requirements/server.txt /app/ -RUN bash setup.sh -RUN pip install -r server.txt +RUN apt update && bash setup.sh && pip install -r server.txt COPY whisper_live /app/whisper_live - COPY run_server.py /app + CMD ["python", "run_server.py"] From d530957b2ccc079d248beea42c0475d690308371 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Fri, 16 Feb 2024 18:58:57 +0530 Subject: [PATCH 02/11] test docker ci on fork --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 156d296b..2c4c0511 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,6 +74,31 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + build-and-push-docker: + needs: [run-tests, check-code-format] + runs-on: ubuntu-22.04 + if: github.event_name == 'push' && github.ref == 'refs/heads/develop' + steps: + - uses: actions/checkout@v2 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GHCR_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + file: docker/Dockerfile + push: true + tags: ghcr.io/makaveli10/whisperlive-cpu:latest publish-to-pypi: needs: [run-tests, check-code-format] From 06794470f8ffc95383f25a15ab21c34e14b5c1e4 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Fri, 16 Feb 2024 19:01:54 +0530 Subject: [PATCH 03/11] build docker image on pus develop --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c4c0511..249dc744 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - develop tags: - v* pull_request: From ff871ad48544ac86141b4c15b440ff7f98d320c5 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Fri, 16 Feb 2024 20:37:59 +0530 Subject: [PATCH 04/11] update dockerfile name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 249dc744..78564124 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,7 +97,7 @@ jobs: uses: docker/build-push-action@v2 with: context: . - file: docker/Dockerfile + file: docker/Dockerfile.cpu push: true tags: ghcr.io/makaveli10/whisperlive-cpu:latest From d1de4948eee737a87a39cc1eefe81f2658d7710d Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Mon, 19 Feb 2024 04:38:41 -0500 Subject: [PATCH 05/11] update base cuda version to 11.8; some dockerfile-gpu fixes --- docker/Dockerfile.gpu | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/docker/Dockerfile.gpu b/docker/Dockerfile.gpu index 3e506567..6b998c97 100644 --- a/docker/Dockerfile.gpu +++ b/docker/Dockerfile.gpu @@ -1,44 +1,30 @@ -FROM nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04 - +FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 ARG DEBIAN_FRONTEND=noninteractive # Remove any third-party apt sources to avoid issues with expiring keys. RUN rm -f /etc/apt/sources.list.d/*.list # Install some basic utilities. -RUN apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ sudo \ git \ bzip2 \ libx11-6 \ - && rm -rf /var/lib/apt/lists/* - -RUN apt update - -# install python -RUN apt install software-properties-common -y && \ - add-apt-repository ppa:deadsnakes/ppa && \ - apt update - -RUN apt install python3-dev -y && \ - apt install python-is-python3 - - -# install pip -RUN apt install python3-pip -y + python3-dev \ + python3-pip \ + && python3 -m pip install --upgrade pip \ + && rm -rf /var/lib/apt/lists/* # Create a working directory. RUN mkdir /app WORKDIR /app -COPY scripts/setup.sh /app -COPY requirements/ /app +COPY scripts/setup.sh requirements/server.txt /app -RUN apt update --fix-missing -RUN bash setup.sh -RUN pip install -r server.txt +RUN apt update && bash setup.sh && rm setup.sh +RUN pip install -r server.txt && rm server.txt COPY whisper_live /app/whisper_live From 0baa1dc0a64351cdb05b20cc296a995c052ea2f9 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Mon, 19 Feb 2024 04:53:39 -0500 Subject: [PATCH 06/11] update ci to build and gpu docker image to ghcr --- .github/workflows/ci.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78564124..d33d584d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ jobs: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - build-and-push-docker: + build-and-push-docker-cpu: needs: [run-tests, check-code-format] runs-on: ubuntu-22.04 if: github.event_name == 'push' && github.ref == 'refs/heads/develop' @@ -100,6 +100,31 @@ jobs: file: docker/Dockerfile.cpu push: true tags: ghcr.io/makaveli10/whisperlive-cpu:latest + + build-and-push-docker-gpu: + needs: [run-tests, check-code-format] + runs-on: ubuntu-22.04 + if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main') + steps: + - uses: actions/checkout@v2 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GHCR_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build and push Docker GPU image + uses: docker/build-push-action@v2 + with: + context: . + file: docker/Dockerfile.gpu + push: true + tags: ghcr.io/makaveli10/whisperlive-gpu:latest publish-to-pypi: needs: [run-tests, check-code-format] From 1147f5822549b072e9715d7c4ea993de56dd0117 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Mon, 19 Feb 2024 05:13:03 -0500 Subject: [PATCH 07/11] increase job timeout --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d33d584d..4ee92e77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,6 +103,7 @@ jobs: build-and-push-docker-gpu: needs: [run-tests, check-code-format] + timeout-minutes: 20 runs-on: ubuntu-22.04 if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main') steps: From 17873c66a03a056ade0a283b702b87d956202f30 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Mon, 19 Feb 2024 06:36:10 -0500 Subject: [PATCH 08/11] prune docker cache --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ee92e77..359d0b1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,7 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - + build-and-push-docker-cpu: needs: [run-tests, check-code-format] runs-on: ubuntu-22.04 @@ -102,13 +102,13 @@ jobs: tags: ghcr.io/makaveli10/whisperlive-cpu:latest build-and-push-docker-gpu: - needs: [run-tests, check-code-format] + needs: [run-tests, check-code-format, build-and-push-docker-cpu] timeout-minutes: 20 runs-on: ubuntu-22.04 if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main') steps: - uses: actions/checkout@v2 - + - name: Log in to GitHub Container Registry uses: docker/login-action@v1 with: @@ -116,6 +116,9 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GHCR_TOKEN }} + - name: Docker Prune + run: docker system prune -af + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 From f975bd452eaf0b20baecc93a7a6c03c1d398c39c Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Wed, 21 Feb 2024 22:49:16 +0530 Subject: [PATCH 09/11] change ghcr owner --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9001cdfe..5c2fef99 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,6 @@ on: push: branches: - main - - develop tags: - v* pull_request: @@ -98,7 +97,7 @@ jobs: context: . file: docker/Dockerfile.cpu push: true - tags: ghcr.io/makaveli10/whisperlive-cpu:latest + tags: ghcr.io/collabora/whisperlive-cpu:latest build-and-push-docker-gpu: needs: [run-tests, check-code-format, build-and-push-docker-cpu] @@ -127,7 +126,7 @@ jobs: context: . file: docker/Dockerfile.gpu push: true - tags: ghcr.io/makaveli10/whisperlive-gpu:latest + tags: ghcr.io/collabora/whisperlive-gpu:latest publish-to-pypi: needs: [run-tests, check-code-format] From b47a56ca6dd747f8346062e268b4ed9f2d628724 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Wed, 21 Feb 2024 22:50:56 +0530 Subject: [PATCH 10/11] update readme to use ghcr docker containers --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index addbfbf2..d4c8460b 100644 --- a/README.md +++ b/README.md @@ -93,16 +93,14 @@ client(hls_url="http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_1xtra/b - GPU - Faster-Whisper ```bash - docker build . -t whisper-live -f docker/Dockerfile.gpu - docker run -it --gpus all -p 9090:9090 whisper-live:latest + docker run -it --gpus all -p 9090:9090 ghcr.io/collabora/whisperlive-gpu:latest ``` - TensorRT. Follow [TensorRT_whisper readme](https://github.com/collabora/WhisperLive/blob/main/TensorRT_whisper.md) in order to setup docker and use TensorRT backend. We provide a pre-built docker image which has TensorRT-LLM built and ready to use. - CPU ```bash -docker build . -t whisper-live -f docker/Dockerfile.cpu -docker run -it -p 9090:9090 whisper-live:latest +docker run -it -p 9090:9090 ghcr.io/collabora/whisperlive-cpu:latest ``` **Note**: By default we use "small" model size. To build docker image for a different model size, change the size in server.py and then build the docker image. From 8bdaf9249d03a5cd3e05a55210c9fbe2c75720c0 Mon Sep 17 00:00:00 2001 From: makaveli10 Date: Wed, 21 Feb 2024 22:56:35 +0530 Subject: [PATCH 11/11] only run docker image build and push on new version release --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5c2fef99..9a4c5eda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: build-and-push-docker-cpu: needs: [run-tests, check-code-format] runs-on: ubuntu-22.04 - if: github.event_name == 'push' && github.ref == 'refs/heads/develop' + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') steps: - uses: actions/checkout@v2 @@ -103,7 +103,7 @@ jobs: needs: [run-tests, check-code-format, build-and-push-docker-cpu] timeout-minutes: 20 runs-on: ubuntu-22.04 - if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main') + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') steps: - uses: actions/checkout@v2