diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml index bdb66b0..570e75e 100644 --- a/.github/workflows/publish-docker.yml +++ b/.github/workflows/publish-docker.yml @@ -10,6 +10,15 @@ on: jobs: build_and_push: runs-on: ubuntu-latest + strategy: + matrix: + include: + - dockerfile: "./Dockerfile" + platforms: "linux/amd64,linux/arm64/v8" + tag_name: "cpu" + - dockerfile: "./nvidia.Dockerfile" + platforms: "linux/amd64" + tag_name: "cuda" steps: - name: Checkout code uses: actions/checkout@v4 @@ -24,13 +33,28 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to DockerHub + if: vars.DOCKERHUB_USERNAME != '' + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . - file: ./Dockerfile - platforms: "linux/amd64" + file: ${{ matrix.dockerfile }} + platforms: ${{ matrix.platforms }} push: true tags: | - ghcr.io/josh-xt/alltalk_tts:latest - ghcr.io/josh-xt/alltalk_tts:main-${{ github.sha }} + ghcr.io/${{ github.actor }}/alltalk_tts:${{ matrix.tag_name }}-${{ github.sha }} + ghcr.io/${{ github.actor }}/alltalk_tts:${{ matrix.tag_name }} + + - name: Docker Hub Description + if: vars.DOCKERHUB_USERNAME != '' + uses: peter-evans/dockerhub-description@v3.4.2 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + repository: ${{ vars.DOCKERHUB_USERNAME }}/alltalk_tts diff --git a/Dockerfile b/Dockerfile index 5a79e77..3c329a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,10 @@ -FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 +FROM python:3-slim-bullseye ENV HOST 0.0.0.0 RUN apt-get update && apt-get upgrade -y \ && apt-get install -y git build-essential \ - python3 python3-pip gcc wget \ - ocl-icd-opencl-dev opencl-headers clinfo \ - libclblast-dev libopenblas-dev \ - && mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd + python3 python3-pip gcc wget WORKDIR /app COPY . . -ENV CUDA_DOCKER_ARCH=all - -RUN pip install --no-cache-dir -r requirements_nvidia.txt && \ - pip install --no-cache-dir -r requirements_finetune.txt && \ - pip install --no-cache-dir -r requirements_other.txt && \ - pip install --no-cache-dir deepspeed +RUN pip install --no-cache-dir -r requirements_other.txt EXPOSE 7851 CMD ["python", "script.py"] diff --git a/nvidia.Dockerfile b/nvidia.Dockerfile new file mode 100644 index 0000000..5a79e77 --- /dev/null +++ b/nvidia.Dockerfile @@ -0,0 +1,18 @@ +FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 +ENV HOST 0.0.0.0 +RUN apt-get update && apt-get upgrade -y \ + && apt-get install -y git build-essential \ + python3 python3-pip gcc wget \ + ocl-icd-opencl-dev opencl-headers clinfo \ + libclblast-dev libopenblas-dev \ + && mkdir -p /etc/OpenCL/vendors && echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd +WORKDIR /app +COPY . . +ENV CUDA_DOCKER_ARCH=all + +RUN pip install --no-cache-dir -r requirements_nvidia.txt && \ + pip install --no-cache-dir -r requirements_finetune.txt && \ + pip install --no-cache-dir -r requirements_other.txt && \ + pip install --no-cache-dir deepspeed +EXPOSE 7851 +CMD ["python", "script.py"]