This repository has been archived by the owner on Jun 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (96 loc) · 3.71 KB
/
make-image.yaml
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
name: Build action-runner
on:
release:
types: [ created ]
jobs:
build-arm64:
strategy:
matrix:
version: [ 2.311.0 ]
arch: [ arm64 ]
runs-on: [self-hosted, linux, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set tags
id: tags
run: |
echo "arch=${{ matrix.arch }}" >> $GITHUB_OUTPUT
echo "runner=${{ matrix.version }}" >> $GITHUB_OUTPUT
echo "image=ghcr.io/${{ github.repository_owner }}/runner-image-${{ matrix.arch }}" >> $GITHUB_OUTPUT
echo "tag=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: |
docker build \
--tag ${{ steps.tags.outputs.image }}:${{ steps.tags.outputs.tag }} \
--build-arg RUNNER_VERSION=${{ steps.tags.outputs.runner }} \
--build-arg RUNNER_ARCH=${{ steps.tags.outputs.arch }} \
--file Dockerfile-bookworm .
- name: Push
run: |
docker push ${{ steps.tags.outputs.image }}:${{ steps.tags.outputs.tag }}
build-amd64:
strategy:
matrix:
version: [ 2.311.0 ]
arch: [ amd64 ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set tags
id: tags
run: |
echo "arch=${{ matrix.arch }}" >> $GITHUB_OUTPUT
echo "runner=${{ matrix.version }}" >> $GITHUB_OUTPUT
echo "image=ghcr.io/${{ github.repository_owner }}/runner-image-${{ matrix.arch }}" >> $GITHUB_OUTPUT
echo "tag=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: |
docker build \
--tag ${{ steps.tags.outputs.image }}:${{ steps.tags.outputs.tag }} \
--build-arg RUNNER_VERSION=${{ steps.tags.outputs.runner }} \
--build-arg RUNNER_ARCH=${{ steps.tags.outputs.arch }} \
--file Dockerfile-bookworm .
- name: Push
run: |
docker push ${{ steps.tags.outputs.image }}:${{ steps.tags.outputs.tag }}
manifest:
needs:
- build-arm64
- build-amd64
runs-on: ubuntu-latest
steps:
- name: Set tags
id: tags
run: |
echo "manifest=ghcr.io/${{ github.repository_owner }}/runner-image" >> $GITHUB_OUTPUT
echo "tag=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create Manifest
run: |
docker manifest create ${{ steps.tags.outputs.manifest }}:${{ steps.tags.outputs.tag }} \
--amend ${{ steps.tags.outputs.manifest }}-arm64:${{ steps.tags.outputs.tag }} \
--amend ${{ steps.tags.outputs.manifest }}-amd64:${{ steps.tags.outputs.tag }}
docker manifest annotate --arch arm64 ${{ steps.tags.outputs.manifest }}:${{ steps.tags.outputs.tag }} \
${{ steps.tags.outputs.manifest }}-arm64:${{ steps.tags.outputs.tag }}
docker manifest annotate --arch amd64 ${{ steps.tags.outputs.manifest }}:${{ steps.tags.outputs.tag }} \
${{ steps.tags.outputs.manifest }}-amd64:${{ steps.tags.outputs.tag }}
docker manifest push ${{ steps.tags.outputs.manifest }}:${{ steps.tags.outputs.tag }}