-
Notifications
You must be signed in to change notification settings - Fork 2
110 lines (91 loc) · 3.44 KB
/
build-bootc.yaml
File metadata and controls
110 lines (91 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Build bootc image
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free up disk space
run: |
df -h /
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
sudo docker image prune --all --force
df -h /
- name: Log in to GHCR
if: github.event_name != 'pull_request'
run: echo "${{ secrets.GITHUB_TOKEN }}" | sudo podman login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin
- name: Build image
run: |
sudo podman build \
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-${{ matrix.arch }} \
--file Containerfile .
- name: Push arch-specific image
if: github.event_name != 'pull_request'
run: sudo podman push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-${{ matrix.arch }}
manifest:
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Log in to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | sudo podman login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
type=ref,event=branch
- name: Create and push manifest lists
run: |
AMD64=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-amd64
ARM64=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}-arm64
echo '${{ steps.meta.outputs.tags }}' | while read -r tag; do
[ -n "${tag}" ] || continue
echo "Creating manifest for ${tag}"
sudo podman manifest create "${tag}" "${AMD64}" "${ARM64}"
sudo podman manifest push --all "${tag}" "docker://${tag}"
done
- name: Install oras
uses: oras-project/setup-oras@v1
- name: Annotate manifest lists
run: |
oras login ${{ env.REGISTRY }} -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
echo '${{ steps.meta.outputs.tags }}' | while read -r tag; do
[ -n "${tag}" ] || continue
echo "Annotating ${tag}..."
oras manifest fetch "${tag}" | jq \
--arg src "https://github.com/${{ github.repository }}" \
--arg rev "${{ github.sha }}" \
'.annotations = {
"org.opencontainers.image.title": "hybrid-inference-in-a-box",
"org.opencontainers.image.description": "Immutable bootc appliance: MicroShift + vLLM Semantic Router",
"org.opencontainers.image.source": $src,
"org.opencontainers.image.revision": $rev
}' > /tmp/annotated-manifest.json
oras manifest push "${tag}" /tmp/annotated-manifest.json
echo "Annotated ${tag}"
done