Skip to content

Commit 06bd7a1

Browse files
committed
Updated
1 parent bc4551a commit 06bd7a1

File tree

3 files changed

+96
-3
lines changed

3 files changed

+96
-3
lines changed
+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Build cuda docker container on publish
2+
on:
3+
release:
4+
types: [ created, edited ]
5+
workflow_dispatch:
6+
inputs:
7+
tag:
8+
description: 'tag'
9+
required: true
10+
default: 'latest'
11+
type: string
12+
jobs:
13+
var:
14+
name: Set variables
15+
runs-on: ubuntu-latest
16+
outputs:
17+
image-cuda-dev: "ghcr.io/mutablelogic/cuda-dev"
18+
image-cuda-runtime: "ghcr.io/mutablelogic/cuda-rt"
19+
tag: ${{ steps.var.outputs.tag }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
- name: Set variables
26+
id: var
27+
run: |
28+
if [ "${{ github.event_name }}" != "release" ] && [ "${{ inputs.tag }}" != "latest" ]; then
29+
TAG="${{ inputs.tag }}" && echo "tag=${TAG#v}" >> $GITHUB_OUTPUT
30+
else
31+
TAG="$(git describe --tags)" && echo "tag=${TAG#v}" >> $GITHUB_OUTPUT
32+
fi
33+
build:
34+
name: Build
35+
needs: var
36+
strategy:
37+
matrix:
38+
arch: [ amd64, arm64 ]
39+
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || matrix.arch == 'arm64' && 'nx1' }}
40+
env:
41+
ARCH: ${{ matrix.arch }}
42+
OS: linux
43+
DOCKER_REGISTRY: ghcr.io/mutablelogic
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 0
49+
- name: Login
50+
uses: docker/login-action@v3
51+
with:
52+
registry: ghcr.io
53+
username: ${{ github.repository_owner }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
55+
- name: Build and Push
56+
id: build
57+
run: |
58+
git checkout v${{ needs.var.outputs.tag }}
59+
make docker-cuda-push
60+
manifest:
61+
name: Create manifest
62+
needs:
63+
- build
64+
- var
65+
strategy:
66+
matrix:
67+
image:
68+
- ${{ needs.var.outputs.image-cuda-dev }}
69+
- ${{ needs.var.outputs.image-cuda-runtime }}
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Login
73+
uses: docker/login-action@v3
74+
with:
75+
registry: ghcr.io
76+
username: ${{ github.repository_owner }}
77+
password: ${{ secrets.GITHUB_TOKEN }}
78+
- name: Create
79+
run: |
80+
docker manifest create ${{ matrix.image }}:${{ needs.var.outputs.tag }} \
81+
--amend ${{ matrix.image }}-linux-amd64:${{ needs.var.outputs.tag }} \
82+
--amend ${{ matrix.image }}-linux-arm64:${{ needs.var.outputs.tag }}
83+
- name: Annotate
84+
run: |
85+
docker manifest annotate --arch arm64 --os linux \
86+
${{ matrix.image }}:${{ needs.var.outputs.tag }} \
87+
${{ matrix.image }}-linux-arm64:${{ needs.var.outputs.tag }}
88+
docker manifest annotate --arch amd64 --os linux \
89+
${{ matrix.image }}:${{ needs.var.outputs.tag }} \
90+
${{ matrix.image }}-linux-amd64:${{ needs.var.outputs.tag }}
91+
- name: Push
92+
run: |
93+
docker manifest push ${{ matrix.image }}:${{ needs.var.outputs.tag }}

.github/workflows/on_publish.yaml renamed to .github/workflows/on_publish_llamacpp.yaml_disabled

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build docker container on publish
1+
name: Build cuda docker container on publish
22
on:
33
release:
44
types: [ created, edited ]

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ test: generate llamacpp
3838
@PKG_CONFIG_PATH=${ROOT_PATH}/${BUILD_DIR} ${GO} test -v ./sys/llamacpp/...
3939

4040
# Base images for building and running CUDA containers
41-
docker-base: docker-dep
41+
docker-cuda: docker-dep
4242
@echo "Building ${DOCKER_TAG_BASE_BUILD}"
4343
@${DOCKER} build \
4444
--tag ${DOCKER_TAG_BASE_BUILD} \
@@ -53,7 +53,7 @@ docker-base: docker-dep
5353
-f Dockerfile.cuda .
5454

5555
# Build docker container - assume we need to build the base images?
56-
docker: docker-dep docker-base
56+
docker-cuda-push: docker-cuda
5757
@echo "Building ${DOCKER_TAG_LLAMACPP}"
5858
@${DOCKER} build \
5959
--tag ${DOCKER_TAG_LLAMACPP} \

0 commit comments

Comments
 (0)