Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit 3550eda

Browse files
committed
working on bundle/package/image
1 parent ad83b0b commit 3550eda

File tree

5 files changed

+30
-78
lines changed

5 files changed

+30
-78
lines changed

.github/workflows/build-images.yaml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ permissions:
1212
contents: read
1313
packages: write
1414

15-
env:
16-
K3S_TAG: ""
17-
CUDA_TAG: ""
18-
1915
jobs:
2016
build-and-publish-images:
2117
runs-on: ubuntu-latest
@@ -24,11 +20,9 @@ jobs:
2420
- name: Checkout Repo
2521
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2622

27-
- name: Read tags from config
28-
id: read_tags
29-
run: |
30-
echo "K3S_TAG=$(jq -r .k3s_tag packages/k3d-gpu/version_config.json)" >> $GITHUB_ENV
31-
echo "CUDA_TAG=$(jq -r .cuda_tag packages/k3d-gpu/version_config.json)" >> $GITHUB_ENV
23+
- name: Version
24+
id: get_version
25+
uses: battila7/get-version-action@90eb8fc70f6dfcf3f9b95ed8f164d2c05038e729 # v2.2.1
3226

3327
- name: Login to GitHub Container Registry
3428
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
@@ -37,12 +31,19 @@ jobs:
3731
username: ${{ github.actor }}
3832
password: ${{ secrets.GITHUB_TOKEN }}
3933

40-
- name: Build and Publish k3d-gpu
34+
- name: Install Zarf
35+
uses: defenseunicorns/setup-zarf@f95763914e20e493bb5d45d63e30e17138f981d6 # v1.0.0
36+
37+
- name: Build and Publish k3d-gpu image
4138
run: |
4239
docker build \
4340
--platform linux/amd64 \
44-
--build-arg K3S_TAG=${{ env.K3S_TAG }} \
45-
--build-arg CUDA_TAG=${{ env.CUDA_TAG }} \
46-
-t ghcr.io/defenseunicorns/leapfrogai/k3d-gpu:latest \
41+
-t ghcr.io/defenseunicorns/leapfrogai/k3d-gpu:${{ steps.get_version.outputs.version-without-v }} \
4742
-f packages/k3d-gpu/Dockerfile .
48-
docker push ghcr.io/defenseunicorns/leapfrogai/k3d-gpu:latest
43+
docker push ghcr.io/defenseunicorns/leapfrogai/k3d-gpu:${{ steps.get_version.outputs.version-without-v }}
44+
45+
- name: Build and Publish k3d-gpu package
46+
run: |
47+
zarf package create packages/k3d-gpu --set=VERSION=${{ steps.get_version.outputs.version-without-v }} --confirm
48+
zarf package publish zarf-package-leapfrogai-k3d-gpu-amd64-${{ steps.get_version.outputs.version-without-v }}.tar.zst \
49+
oci://ghcr.io/defenseunicorns/packages/leapfrogai

packages/k3d-gpu/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ARG K3S_TAG
2-
ARG CUDA_TAG
1+
ARG K3S_TAG=v1.28.8-k3s1
2+
ARG CUDA_TAG=12.4.1-base-ubuntu22.04
33

44
FROM rancher/k3s:$K3S_TAG AS k3s
55
FROM nvidia/cuda:$CUDA_TAG

packages/k3d-gpu/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MAKEFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
22

3-
k3d-gpu-package:
3+
build-k3d-gpu:
44
@cd ${MAKEFILE_DIR} && \
55
uds zarf package create
66

packages/k3d-gpu/zarf-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ package:
44
# x-release-please-start-version
55
version: 0.9.1
66
# x-release-please-end
7-
reg_name: registry
7+
uds_flavor: k3d-core-slim-dev
8+
uds_version: 0.24.0
9+
arch: amd64

packages/k3d-gpu/zarf.yaml

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -7,77 +7,26 @@ metadata:
77
description: >
88
k3d base image with GPU support
99
10-
variables:
11-
- name: REG_PORT
12-
description: "Local registry port"
13-
default: "5000"
14-
- name: UDS_CORE
15-
description: "UDS Core version to use"
16-
default: "k3d-core-slim-dev:0.24.0"
17-
- name: K3S_TAG
18-
description: "K3s version to use"
19-
default: "v1.28.8-k3s1"
20-
- name: CUDA_TAG
21-
description: "CUDA version to use"
22-
default: "12.4.1-base-ubuntu22.04"
23-
2410
components:
25-
- name: create-local-registry
11+
- name: create-uds-cluster
2612
required: true
2713
actions:
28-
onDeploy:
29-
before:
30-
- cmd: |
31-
set +e
32-
docker run -d --name ###ZARF_PKG_TMPL_REG_NAME### -p ${ZARF_VAR_REG_PORT}:5000 registry:2
33-
set -e
34-
description: "Start the local registry"
35-
onRemove:
14+
onCreate:
3615
before:
3716
- cmd: |
38-
set +e
39-
docker stop ###ZARF_PKG_TMPL_REG_NAME###
40-
docker rm ###ZARF_PKG_TMPL_REG_NAME###
41-
set -e
42-
description: "Stop and remove the local registry"
17+
uds pull ghcr.io/defenseunicorns/packages/uds/bundles/###ZARF_PKG_TMPL_UDS_FLAVOR###:###ZARF_PKG_TMPL_UDS_VERSION### -a ###ZARF_PKG_TMPL_ARCH###
18+
description: "Pull the UDS K3D slim dev bundle"
4319
44-
- name: build-image
45-
required: true
46-
files:
47-
- source: Dockerfile
48-
target: Dockerfile
49-
- source: plugin/device-plugin-daemonset.yaml
50-
target: plugin/device-plugin-daemonset.yaml
51-
actions:
52-
onDeploy:
53-
before:
5420
- cmd: |
55-
docker build \
56-
--platform linux/amd64 \
57-
--build-arg K3S_TAG=${ZARF_VAR_K3S_TAG} \
58-
--build-arg CUDA_TAG=${ZARF_VAR_CUDA_TAG} \
59-
-t ghcr.io/defenseunicorns/leapfrogai/k3d-gpu:###ZARF_PKG_TMPL_VERSION### \
60-
-f ./Dockerfile .
61-
62-
docker tag \
63-
ghcr.io/defenseunicorns/leapfrogai/k3d-gpu:###ZARF_PKG_TMPL_VERSION### \
64-
localhost:${ZARF_VAR_REG_PORT}/defenseunicorns/leapfrogai/k3d-gpu:###ZARF_PKG_TMPL_VERSION###
65-
description: "Build the k3d-gpu image"
66-
after:
67-
- cmd:
68-
docker push localhost:${ZARF_VAR_REG_PORT}/defenseunicorns/leapfrogai/k3d-gpu:###ZARF_PKG_TMPL_VERSION###
69-
description: "Push the image to the local registry"
70-
71-
- name: create-cluster
72-
required: true
73-
actions:
21+
docker pull ghcr.io/defenseunicorns/leapfrogai/k3d-gpu:###ZARF_PKG_TMPL_VERSION###
22+
description: "Pull the k3d-gpu image"
7423
onDeploy:
7524
before:
7625
- cmd: |
77-
uds deploy ${ZARF_VAR_UDS_CORE} \
26+
uds deploy uds-bundle-###ZARF_PKG_TMPL_UDS_FLAVOR###-###ZARF_PKG_TMPL_ARCH###-###ZARF_PKG_TMPL_UDS_VERSION###.tar.zst \
7827
--set K3D_EXTRA_ARGS="--gpus=all \
79-
--image=localhost:${ZARF_VAR_REG_PORT}/defenseunicorns/leapfrogai/k3d-gpu:###ZARF_PKG_TMPL_VERSION###" \
80-
--no-progress --insecure --confirm
28+
--image=ghcr.io/defenseunicorns/leapfrogai/k3d-gpu:###ZARF_PKG_TMPL_VERSION###" \
29+
--no-progress --confirm
8130
description: "Create a k3d cluster with GPU support"
8231
onRemove:
8332
before:

0 commit comments

Comments
 (0)