Skip to content

Commit f9fb21c

Browse files
authored
Change GitHub Workflow to build containers (#148)
* Update docker-build.yml - add build matrix - update build-push-action to v7 * Update docker-build.yml - whoopsie, only push images to ghcr on merge to main * Update docker-build.yml - remove QEMU and also use matrix for runners - fix typo
1 parent 41222f5 commit f9fb21c

1 file changed

Lines changed: 61 additions & 13 deletions

File tree

‎.github/workflows/docker-build.yml‎

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,58 @@ env:
1313

1414
jobs:
1515
build-and-push:
16-
runs-on: ubuntu-latest
1716
permissions:
1817
contents: read
1918
packages: write
2019

20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
# NVIDIA CUDA 12.1
25+
- dockerfile: Dockerfile
26+
tag-suffix: nvidia
27+
platforms: linux/amd64
28+
build-args: RUNTIME=nvidia
29+
runner: ubuntu-latest
30+
31+
# NVIDIA CUDA 12.8 Blackwell
32+
- dockerfile: Dockerfile.cu128
33+
tag-suffix: cu128
34+
platforms: linux/amd64
35+
build-args: RUNTIME=nvidia
36+
runner: ubuntu-latest
37+
38+
# NVIDIA CUDA 13.0 Blackwell sm121 (ARM64)
39+
- dockerfile: Dockerfile.cu130
40+
tag-suffix: cu130
41+
platforms: linux/arm64
42+
build-args: RUNTIME=nvidia
43+
runner: ubuntu-24.04-arm
44+
45+
# AMD ROCm
46+
- dockerfile: Dockerfile.rocm
47+
tag-suffix: rocm
48+
platforms: linux/amd64
49+
build-args: ""
50+
runner: ubuntu-latest
51+
52+
# AMD Strix Halo ROCm
53+
- dockerfile: Dockerfile.strixhalo
54+
tag-suffix: strixhalo
55+
platforms: linux/amd64
56+
build-args: ""
57+
runner: ubuntu-latest
58+
59+
# CPU only
60+
- dockerfile: Dockerfile.cpu
61+
tag-suffix: cpu
62+
platforms: linux/amd64
63+
build-args: ""
64+
runner: ubuntu-latest
65+
66+
runs-on: ${{ matrix.runner }}
67+
2168
steps:
2269
- name: Checkout repository
2370
uses: actions/checkout@v4
@@ -26,33 +73,34 @@ jobs:
2673
uses: docker/setup-buildx-action@v3
2774

2875
- name: Log in to GitHub Container Registry
76+
if: github.event_name != 'pull_request'
2977
uses: docker/login-action@v3
3078
with:
3179
registry: ${{ env.REGISTRY }}
3280
username: ${{ github.actor }}
3381
password: ${{ secrets.GITHUB_TOKEN }}
3482

35-
- name: Extract metadata (tags, labels) for Docker
83+
- name: Extract metadata for Docker
3684
id: meta
3785
uses: docker/metadata-action@v5
3886
with:
3987
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4088
tags: |
41-
type=ref,event=branch
42-
type=ref,event=pr
43-
type=semver,pattern={{version}}
44-
type=semver,pattern={{major}}.{{minor}}
45-
type=sha,format=short
89+
type=ref,event=branch,suffix=-${{ matrix.tag-suffix }}
90+
type=ref,event=pr,suffix=-${{ matrix.tag-suffix }}
91+
type=semver,pattern={{version}},suffix=-${{ matrix.tag-suffix }}
92+
type=semver,pattern={{major}}.{{minor}},suffix=-${{ matrix.tag-suffix }}
93+
type=sha,format=short,suffix=-${{ matrix.tag-suffix }}
4694
4795
- name: Build and push Docker image
48-
uses: docker/build-push-action@v5
96+
uses: docker/build-push-action@v7
4997
with:
5098
context: .
99+
file: ${{ matrix.dockerfile }}
100+
platforms: ${{ matrix.platforms }}
51101
push: ${{ github.event_name != 'pull_request' }}
52102
tags: ${{ steps.meta.outputs.tags }}
53103
labels: ${{ steps.meta.outputs.labels }}
54-
cache-from: type=gha
55-
cache-to: type=gha,mode=max
56-
platforms: linux/amd64
57-
build-args: |
58-
RUNTIME=nvidia
104+
build-args: ${{ matrix.build-args }}
105+
cache-from: type=gha,scope=${{ matrix.tag-suffix }}
106+
cache-to: type=gha,mode=max,scope=${{ matrix.tag-suffix }}

0 commit comments

Comments
 (0)