diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e5f3576..9a4c5eda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,6 +74,60 @@ 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-cpu: + needs: [run-tests, check-code-format] + runs-on: ubuntu-22.04 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + 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.cpu + push: true + tags: ghcr.io/collabora/whisperlive-cpu:latest + + build-and-push-docker-gpu: + needs: [run-tests, check-code-format, build-and-push-docker-cpu] + timeout-minutes: 20 + runs-on: ubuntu-22.04 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + 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: Docker Prune + run: docker system prune -af + + - 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/collabora/whisperlive-gpu:latest + publish-to-pypi: needs: [run-tests, check-code-format] runs-on: ubuntu-22.04 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. 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"] 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