Skip to content

Commit c8503cd

Browse files
committed
Ensure releases are created correctly
1 parent 764c11f commit c8503cd

2 files changed

Lines changed: 39 additions & 13 deletions

File tree

.github/workflows/release.yaml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,61 @@
1-
#
21
name: Create and publish a Docker image
32

43
on:
54
release:
65
types: [ created ]
6+
push:
7+
branches: [ main ]
78

8-
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
99
env:
1010
REGISTRY: ghcr.io
1111
IMAGE_NAME: ${{ github.repository }}
1212

13-
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
1413
jobs:
1514
build-and-push-image:
1615
runs-on: ubuntu-latest
17-
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
16+
strategy:
17+
matrix:
18+
variant: [ cuda, cpu ]
1819
permissions:
1920
contents: read
2021
packages: write
2122
attestations: write
2223
id-token: write
23-
#
2424
steps:
2525
- name: Checkout repository
2626
uses: actions/checkout@v4
27-
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
27+
2828
- name: Log in to the Container registry
2929
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
3030
with:
3131
registry: ${{ env.REGISTRY }}
3232
username: ${{ github.actor }}
3333
password: ${{ secrets.GITHUB_TOKEN }}
34-
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
34+
3535
- name: Extract metadata (tags, labels) for Docker
3636
id: meta
3737
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
3838
with:
3939
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40-
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
41-
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
42-
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
40+
tags: |
41+
type=ref,event=tag
42+
type=ref,event=branch
43+
type=semver,pattern={{version}}
44+
type=raw,value=${{ matrix.variant }},enable=${{ matrix.variant != 'cpu' }}
45+
4346
- name: Build and push Docker image
4447
id: push
4548
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
4649
with:
4750
context: .
51+
file: ${{ matrix.variant == 'cuda' && 'Dockerfile.cuda' || 'Dockerfile' }}
4852
push: true
4953
tags: ${{ steps.meta.outputs.tags }}
5054
labels: ${{ steps.meta.outputs.labels }}
5155

52-
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [Using artifact attestations to establish provenance for builds](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
5356
- name: Generate artifact attestation
5457
uses: actions/attest-build-provenance@v2
5558
with:
56-
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
59+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
5760
subject-digest: ${{ steps.push.outputs.digest }}
5861
push-to-registry: true
59-

Dockerfile.cuda

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM nvidia/cuda:12.6.0-runtime-ubuntu24.04
2+
3+
ENV PYTHONPATH=/app
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
WORKDIR /app/src
7+
8+
# Install Python
9+
RUN apt-get update && \
10+
apt-get install -y --no-install-recommends python3 python3-pip && \
11+
rm -rf /var/lib/apt/lists/*
12+
13+
# Download required model files
14+
RUN mkdir -p /app/src
15+
ADD --checksum=sha256:7d5df8ecf7d4b1878015a32686053fd0eebe2bc377234608764cc0ef3636a6c5 https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/kokoro-v1.0.onnx /app/src/kokoro-v1.0.onnx
16+
ADD --checksum=sha256:bca610b8308e8d99f32e6fe4197e7ec01679264efed0cac9140fe9c29f1fbf7d https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/voices-v1.0.bin /app/src/voices-v1.0.bin
17+
18+
# Install required packages
19+
COPY requirements.txt .
20+
RUN pip3 install --break-system-packages -r requirements.txt
21+
22+
COPY src/ /app/src/
23+
24+
ENTRYPOINT ["/usr/bin/python3", "main.py"]

0 commit comments

Comments
 (0)