diff --git a/.github/workflows/publish-docker.yml b/.github/workflows/publish-docker.yml new file mode 100644 index 0000000..6f5a605 --- /dev/null +++ b/.github/workflows/publish-docker.yml @@ -0,0 +1,51 @@ +name: Publish Docker image + +on: + push: + branches: [main] + release: + types: [published] + workflow_dispatch: + +jobs: + build_and_push: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - image_name: "python:3.11-slim" + gpu_type: "other" + platforms: "linux/amd64,linux/arm64/v8" + tag_name: "other" + - image_name: "nvidia/cuda:12.1.1-devel-ubuntu22.04" + gpu_type: "nvidia" + platforms: "linux/amd64" + tag_name: "cuda" + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + platforms: ${{ matrix.platforms }} + push: true + tags: | + ghcr.io/josh-xt/alltalk_tts:${{ matrix.tag_name }} + ghcr.io/josh-xt/alltalk_tts:${{ matrix.tag_name }}-${{ github.sha }} + build-args: | + image_name=${{ matrix.image_name }} + gpu_type=${{ matrix.gpu_type }} diff --git a/Dockerfile b/Dockerfile index 1624570..5a3a349 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM python:3.11-slim +ARG image_name=python:3.11-slim +FROM ${image_name} WORKDIR /app COPY . . # Argument for specifying the GPU type, defaulting to "other"