@@ -12,90 +12,62 @@ jobs:
12
12
test-build :
13
13
name : Test Build on Pull Request
14
14
if : github.event_name == 'pull_request'
15
- runs-on : self-hosted
15
+ runs-on : builder
16
16
steps :
17
17
- name : Checkout repository
18
18
uses : actions/checkout@v4
19
19
20
- - name : Build image for testing
21
- uses : redhat-actions/buildah-build@v2
20
+ - name : Set up Docker Buildx
21
+ uses : docker/setup-buildx-action@v3
22
+
23
+ - name : Build Docker image for testing
24
+ uses : docker/build-push-action@v6
22
25
with :
23
- image : podmortem-log-parser-test
24
- tags : latest
25
- containerfiles : |
26
- ./src/main/docker/Dockerfile.native
26
+ context : .
27
+ file : ./src/main/docker/Dockerfile.native
28
+ platforms : linux/amd64
29
+ push : false
30
+ cache-from : type=gha
31
+ cache-to : type=gha,mode=max
27
32
build-args : |
28
33
GITHUB_USER=${{ github.actor }}
29
34
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
30
35
31
36
build-and-push :
32
37
name : Build and Push on Main
33
38
if : github.event_name == 'push' && github.ref == 'refs/heads/main'
34
- runs-on : self-hosted
39
+ runs-on : builder
35
40
permissions :
36
41
contents : read
37
42
packages : write
43
+
38
44
steps :
39
45
- name : Checkout repository
40
46
uses : actions/checkout@v4
41
47
42
- - name : Set up QEMU
43
- uses : docker/setup-qemu-action@v3
44
-
45
- - name : Build AMD64 image
46
- id : build-amd64
47
- uses : redhat-actions/buildah-build@v2
48
- with :
49
- image : ghcr.io/${{ github.repository_owner }}/podmortem-log-parser
50
- tags : latest-amd64 ${{ github.sha }}-amd64
51
- containerfiles : |
52
- ./src/main/docker/Dockerfile.native
53
- build-args : |
54
- GITHUB_USER=${{ github.actor }}
55
- GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
56
- TARGETARCH=amd64
57
- TARGETOS=linux
58
-
59
- - name : Build ARM64 image
60
- id : build-arm64
61
- uses : redhat-actions/buildah-build@v2
62
- with :
63
- image : ghcr.io/${{ github.repository_owner }}/podmortem-log-parser
64
- tags : latest-arm64 ${{ github.sha }}-arm64
65
- containerfiles : |
66
- ./src/main/docker/Dockerfile.native
67
- build-args : |
68
- GITHUB_USER=${{ github.actor }}
69
- GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
70
- TARGETARCH=arm64
71
- TARGETOS=linux
48
+ - name : Set up Docker Buildx
49
+ uses : docker/setup-buildx-action@v3
72
50
73
- - name : Push AMD64 image
74
- uses : redhat-actions/push-to-registry@v2
51
+ - name : Log in to the GitHub Container Registry
52
+ uses : docker/login-action@v3
75
53
with :
76
- image : ${{ steps.build-amd64.outputs.image }}
77
- tags : ${{ steps.build-amd64.outputs.tags }}
78
54
registry : ghcr.io
79
55
username : ${{ github.actor }}
80
56
password : ${{ secrets.GH_PAT }}
81
57
82
- - name : Push ARM64 image
83
- uses : redhat-actions/push-to-registry@v2
58
+ - name : Build and push Docker image
59
+ id : build-and-push
60
+ uses : docker/build-push-action@v6
84
61
with :
85
- image : ${{ steps.build-arm64.outputs.image }}
86
- tags : ${{ steps.build-arm64.outputs.tags }}
87
- registry : ghcr.io
88
- username : ${{ github.actor }}
89
- password : ${{ secrets.GH_PAT }}
90
-
91
- - name : Create and push manifest list
92
- run : |
93
- buildah manifest create ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:latest
94
- buildah manifest add ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:latest ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:latest-amd64
95
- buildah manifest add ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:latest ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:latest-arm64
96
- buildah manifest push --all ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:latest docker://ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:latest
97
-
98
- buildah manifest create ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:${{ github.sha }}
99
- buildah manifest add ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:${{ github.sha }} ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:${{ github.sha }}-amd64
100
- buildah manifest add ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:${{ github.sha }} ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:${{ github.sha }}-arm64
101
- buildah manifest push --all ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:${{ github.sha }} docker://ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:${{ github.sha }}
62
+ context : .
63
+ file : ./src/main/docker/Dockerfile.native
64
+ platforms : linux/amd64,linux/arm64
65
+ push : true
66
+ cache-from : type=gha
67
+ cache-to : type=gha,mode=max
68
+ tags : |
69
+ ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:latest
70
+ ghcr.io/${{ github.repository_owner }}/podmortem-log-parser:${{ github.sha }}
71
+ build-args : |
72
+ GITHUB_USER=${{ github.actor }}
73
+ GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
0 commit comments