11
11
jobs :
12
12
13
13
base :
14
- runs-on : ubuntu-latest
14
+ runs-on : ${{ github.repository_owner == 'emqx' && matrix.platform[2] || '[" ubuntu-latest"]' }}
15
15
strategy :
16
16
fail-fast : false
17
17
matrix :
18
18
base_image_vsn :
19
19
- " 5.0"
20
20
platform :
21
- - [ubuntu22.04 , "linux/amd64,linux/arm64"]
22
- - [ubuntu20.04 , "linux/amd64,linux/arm64"]
23
- - [ubuntu18.04 , "linux/amd64,linux/arm64"]
24
- - [ubuntu16.04 , "linux/amd64,linux/arm64"]
25
- - [debian12 , "linux/amd64,linux/arm64"]
26
- - [debian11 , "linux/amd64,linux/arm64"]
27
- - [debian10 , "linux/amd64,linux/arm64"]
28
- - [debian9 , "linux/amd64,linux/arm64"]
29
- - [el9 , "linux/amd64,linux/arm64"]
30
- - [el8 , "linux/amd64,linux/arm64"]
31
- - [el7 , "linux/amd64,linux/arm64"]
32
- - [amzn2 , "linux/amd64,linux/arm64"]
33
- - [amzn2023 , "linux/amd64,linux/arm64"]
34
- - [alpine3.15.1, "linux/amd64,linux/arm64"]
21
+ - [ubuntu22.04, linux/amd64, [self-hosted, linux, x64, ephemeral]]
22
+ - [ubuntu22.04, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
23
+ - [ubuntu20.04, linux/amd64, [self-hosted, linux, x64, ephemeral]]
24
+ - [ubuntu20.04, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
25
+ - [ubuntu18.04, linux/amd64, [self-hosted, linux, x64, ephemeral]]
26
+ - [ubuntu18.04, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
27
+ - [ubuntu16.04, linux/amd64, [self-hosted, linux, x64, ephemeral]]
28
+ - [ubuntu16.04, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
29
+ - [debian12, linux/amd64, [self-hosted, linux, x64, ephemeral]]
30
+ - [debian12, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
31
+ - [debian11, linux/amd64, [self-hosted, linux, x64, ephemeral]]
32
+ - [debian11, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
33
+ - [debian10, linux/amd64, [self-hosted, linux, x64, ephemeral]]
34
+ - [debian10, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
35
+ - [debian9, linux/amd64, [self-hosted, linux, x64, ephemeral]]
36
+ - [debian9, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
37
+ - [el9, linux/amd64, [self-hosted, linux, x64, ephemeral]]
38
+ - [el9, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
39
+ - [el8, linux/amd64, [self-hosted, linux, x64, ephemeral]]
40
+ - [el8, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
41
+ - [el7, linux/amd64, [self-hosted, linux, x64, ephemeral]]
42
+ - [el7, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
43
+ - [amzn2, linux/amd64, [self-hosted, linux, x64, ephemeral]]
44
+ - [amzn2, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
45
+ - [amzn2023, linux/amd64, [self-hosted, linux, x64, ephemeral]]
46
+ - [amzn2023, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
47
+ - [alpine3.15.1, linux/amd64, [self-hosted, linux, x64, ephemeral]]
48
+ - [alpine3.15.1, linux/arm64, [self-hosted, linux, arm64, ephemeral]]
49
+
50
+ env :
51
+ REGISTRY_IMAGE : ghcr.io/${{ github.repository }}/base-${{ matrix.base_image_vsn }}
35
52
36
53
steps :
37
54
- uses : actions/checkout@v3
@@ -40,23 +57,30 @@ jobs:
40
57
aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
41
58
aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
42
59
aws-region : ${{ secrets.AWS_DEFAULT_REGION }}
60
+ - name : define base tag
61
+ id : base_tag
62
+ run : |
63
+ PLATFORM=${{ matrix.platform[1] }}
64
+ ARCH=${PLATFORM#linux/}
65
+ echo "tag=${{ matrix.platform[0] }}-${ARCH}" | tee -a $GITHUB_OUTPUT
43
66
- name : Get cache
44
- run : aws s3 sync s3://docker-buildx-cache/emqx-builder/${{ matrix.platform[0] }} /tmp/.docker-buildx-cache
45
- - uses : docker/setup-buildx-action@v2
46
- - uses : docker/setup-qemu-action@v2
47
- - uses : docker/login-action@v2
67
+ run : aws s3 sync s3://docker-buildx-cache/emqx-builder/${{ steps.base_tag.outputs.tag }} /tmp/.docker-buildx-cache
68
+ - uses : docker/setup-buildx-action@v3
69
+ - uses : docker/setup-qemu-action@v3
70
+ - uses : docker/login-action@v3
48
71
with :
49
72
registry : ghcr.io
50
73
username : ${{ github.actor }}
51
74
password : ${{ github.token }}
52
- - uses : docker/metadata-action@v4
75
+ - uses : docker/metadata-action@v5
53
76
id : base_meta
54
77
with :
55
- images : ghcr.io/ ${{ github.repository }}/base-${{ matrix.base_image_vsn }}
56
- tags : type=raw,value=${{ matrix.platform[0] }}
78
+ images : ${{ env.REGISTRY_IMAGE }}
79
+ tags : type=raw,value=${{ steps.base_tag.outputs.tag }}
57
80
- name : Build base image
58
- uses : docker/build-push-action@v3
81
+ uses : docker/build-push-action@v5
59
82
with :
83
+ push : true
60
84
pull : true
61
85
cache-from : type=local,src=/tmp/.docker-buildx-cache,mode=max
62
86
cache-to : type=local,dest=/tmp/.docker-buildx-cache-new,mode=max
66
90
file : ${{ matrix.platform[0] }}/Dockerfile
67
91
context : .
68
92
- name : Update cache
69
- run : aws s3 sync --delete /tmp/.docker-buildx-cache-new s3://docker-buildx-cache/emqx-builder/${{ matrix.platform[0] }}
93
+ run : aws s3 sync --delete /tmp/.docker-buildx-cache-new s3://docker-buildx-cache/emqx-builder/${{ steps.base_tag.outputs.tag }}
0 commit comments