diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dfdf28ef..22e64261 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,9 @@ jobs: BUILDKIT_STEP_LOG_MAX_SIZE: 10485760 # These environment variables will override the defaults within docker-bake.hcl VERSION: ${{ needs.prepare-release.outputs.version_tag }} # Use tag version (vX.Y.Z) for bake + strategy: + matrix: + build_target: ["cpu", "cpu-arm64", "gpu-arm64", "gpu"] REGISTRY: ${{ vars.REGISTRY || 'ghcr.io' }} # Override with GitHub Action Environment Variable OWNER: ${{ vars.OWNER || 'remsky' }} REPO: ${{ vars.REPO || 'kokoro-fastapi' }} @@ -88,7 +91,7 @@ jobs: run: | echo "Building and pushing images for version ${{ needs.prepare-release.outputs.version_tag }}" # The VERSION env var above sets the tag for the bake file targets - docker buildx bake --push + docker buildx bake ${{ matrix.build_target }} --push create-release: needs: [prepare-release, build-images] diff --git a/docker-bake.hcl b/docker-bake.hcl index e29599a0..a66b70af 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -61,8 +61,41 @@ target "gpu" { } # Default group to build both CPU and GPU versions -group "default" { - targets = ["cpu", "gpu"] +target "cpu" { + inherits = ["_cpu_base"] + platforms = ["linux/amd64"] + tags = [ + "${REGISTRY}/${OWNER}/${REPO}-cpu:${VERSION}", + "${REGISTRY}/${OWNER}/${REPO}-cpu:latest" + ] +} + +target "cpu-arm64" { + inherits = ["_cpu_base"] + platforms = ["linux/arm64"] + tags = [ + "${REGISTRY}/${OWNER}/${REPO}-cpu:${VERSION}", + "${REGISTRY}/${OWNER}/${REPO}-cpu:latest" + ] +} + +# GPU target with multi-platform support +target "gpu" { + inherits = ["_gpu_base"] + platforms = ["linux/amd64"] + tags = [ + "${REGISTRY}/${OWNER}/${REPO}-gpu:${VERSION}", + "${REGISTRY}/${OWNER}/${REPO}-gpu:latest" + ] +} + +target "gpu-arm64" { + inherits = ["_gpu_base"] + platforms = ["linux/arm64"] + tags = [ + "${REGISTRY}/${OWNER}/${REPO}-gpu:${VERSION}", + "${REGISTRY}/${OWNER}/${REPO}-gpu:latest" + ] } # Development targets for faster local builds @@ -80,4 +113,4 @@ target "gpu-dev" { group "dev" { targets = ["cpu-dev", "gpu-dev"] -} \ No newline at end of file +}