From 4312e9a6b2a0721c82b05de31eb5a9e5bbc89654 Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Thu, 12 May 2022 18:56:34 +0200 Subject: [PATCH] Add CPU only Docker image --- .github/workflows/docker.yaml | 11 ++++++++++- Dockerfile | 14 +++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 457649a22e..9d2d8d8fec 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -14,6 +14,9 @@ jobs: strategy: matrix: arch: ["amd64"] + base: + - "nvcr.io/nvidia/pytorch:22.03-py3" # GPU enabled + - "ubuntu:20.04" # CPU only steps: - uses: actions/checkout@v2 - name: Log in to the Container registry @@ -28,6 +31,11 @@ jobs: set -ex base="ghcr.io/coqui-ai/tts" tags="" # PR build + + if [[ ${{ matrix.base }} = "ubuntu:20.04" ]]; then + base="ghcr.io/coqui-ai/tts-cpu" + fi + if [[ "${{ startsWith(github.ref, 'refs/heads/') }}" = "true" ]]; then # Push to branch github_ref="${{ github.ref }}" @@ -53,4 +61,5 @@ jobs: context: . platforms: linux/${{ matrix.arch }} push: ${{ github.event_name == 'push' }} - tags: ${{ steps.compute-tag.outputs.tags }} + build-args: "BASE=${{ matrix.base }}" + tags: ${{ steps.compute-tag.outputs.tags }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3cc41d6fb7..f055cba451 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,14 @@ -FROM nvcr.io/nvidia/pytorch:22.03-py3 -RUN apt-get update && apt-get install -y --no-install-recommends espeak espeak-ng && rm -rf /var/lib/apt/lists/* +ARG BASE=nvcr.io/nvidia/pytorch:22.03-py3 +FROM ${BASE} +RUN apt-get update && apt-get install -y --no-install-recommends gcc g++ make python3 python3-dev python3-pip python3-venv python3-wheel espeak espeak-ng libsndfile1-dev && rm -rf /var/lib/apt/lists/* RUN pip install llvmlite --ignore-installed + +# Create and activate virtual env +ENV VIRTUAL_ENV=/venv +RUN python3 -m venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +RUN pip install -U pip setuptools wheel + WORKDIR /root COPY requirements.txt /root COPY requirements.dev.txt /root @@ -9,4 +17,4 @@ RUN ["/bin/bash", "-c", "pip install -r <(cat requirements.txt requirements.dev. COPY . /root RUN make install ENTRYPOINT ["tts"] -CMD ["--help"] +CMD ["--help"] \ No newline at end of file