1
- name : Docker Build
1
+ name : Container build
2
2
3
3
on :
4
- push :
5
- paths-ignore :
6
- - " **.md"
7
- branches :
8
- - ' main'
4
+ workflow_run :
5
+ workflows : ["Release Build"]
6
+ types :
7
+ - completed
8
+ env :
9
+ REGISTRY_IMAGE : quay.io/redlib/redlib
9
10
10
11
jobs :
11
- build-docker :
12
+ build :
12
13
runs-on : ubuntu-latest
13
14
strategy :
15
+ fail-fast : false
14
16
matrix :
15
- config :
16
- - { platform: ' linux/amd64', tag: 'latest', dockerfile: 'Dockerfile' }
17
- - { platform: ' linux/arm64', tag: 'latest-arm', dockerfile: 'Dockerfile.arm' }
18
- - { platform: ' linux/arm/v7', tag: 'latest- armv7', dockerfile: 'Dockerfile.armv7' }
17
+ include :
18
+ - { platform: linux/amd64, target: x86_64-unknown-linux-musl }
19
+ - { platform: linux/arm64, target: aarch64-unknown-linux-musl }
20
+ - { platform: linux/arm/v7, target: armv7-unknown-linux-musleabihf }
19
21
steps :
20
- - name : Checkout sources
21
- uses : actions/checkout@v3
22
-
23
- - name : Set up QEMU
24
- uses : docker/setup-qemu-action@v2
22
+ -
23
+ name : Checkout
24
+ uses : actions/checkout@v4
25
+ -
26
+ name : Docker meta
27
+ id : meta
28
+ uses : docker/metadata-action@v5
25
29
with :
26
- platforms : all
27
-
28
- - name : Set up Docker Buildx
29
- id : buildx
30
- uses : docker/setup-buildx-action@v2
30
+ images : ${{ env.REGISTRY_IMAGE }}
31
+ tags : |
32
+ type=sha
33
+ type=raw,value=latest,enable={{is_default_branch}}
34
+ -
35
+ name : Set up QEMU
36
+ uses : docker/setup-qemu-action@v3
37
+ -
38
+ name : Set up Docker Buildx
39
+ uses : docker/setup-buildx-action@v3
40
+ -
41
+ name : Login to Quay.io Container Registry
42
+ uses : docker/login-action@v3
31
43
with :
32
- version : latest
33
-
34
- - name : Login to Quay.io
44
+ registry : quay.io
45
+ username : ${{ secrets.QUAY_USERNAME }}
46
+ password : ${{ secrets.QUAY_ROBOT_TOKEN }}
47
+ -
48
+ name : Build and push
49
+ id : build
50
+ uses : docker/build-push-action@v5
51
+ with :
52
+ context : .
53
+ platforms : ${{ matrix.platform }}
54
+ labels : ${{ steps.meta.outputs.labels }}
55
+ outputs : type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
56
+ file : Dockerfile
57
+ build-args : TARGET=${{ matrix.target }}
58
+ -
59
+ name : Export digest
60
+ run : |
61
+ mkdir -p /tmp/digests
62
+ digest="${{ steps.build.outputs.digest }}"
63
+ touch "/tmp/digests/${digest#sha256:}"
64
+ -
65
+ name : Upload digest
66
+ uses : actions/upload-artifact@v3
67
+ with :
68
+ name : digests
69
+ path : /tmp/digests/*
70
+ if-no-files-found : error
71
+ retention-days : 1
72
+ merge :
73
+ runs-on : ubuntu-latest
74
+ needs :
75
+ - build
76
+ steps :
77
+ -
78
+ name : Download digests
79
+ uses : actions/download-artifact@v3
80
+ with :
81
+ name : digests
82
+ path : /tmp/digests
83
+ -
84
+ name : Set up Docker Buildx
85
+ uses : docker/setup-buildx-action@v3
86
+ -
87
+ name : Docker meta
88
+ id : meta
89
+ uses : docker/metadata-action@v5
90
+ with :
91
+ images : ${{ env.REGISTRY_IMAGE }}
92
+ tags : |
93
+ type=sha
94
+ type=raw,value=latest,enable={{is_default_branch}}
95
+ -
96
+ name : Login to Quay.io Container Registry
35
97
uses : docker/login-action@v3
36
98
with :
37
99
registry : quay.io
38
100
username : ${{ secrets.QUAY_USERNAME }}
39
101
password : ${{ secrets.QUAY_ROBOT_TOKEN }}
102
+ -
103
+ name : Create manifest list and push
104
+ working-directory : /tmp/digests
105
+ run : |
106
+ docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
107
+ $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
40
108
41
- - name : push README to Quay.io
109
+ - name : Push README to Quay.io
42
110
uses : christian-korneck/update-container-description-action@v1
43
111
env :
44
112
DOCKER_APIKEY : ${{ secrets.APIKEY__QUAY_IO }}
@@ -47,13 +115,8 @@ jobs:
47
115
provider : quay
48
116
readme_file : ' README.md'
49
117
50
- - name : Build and push
51
- uses : docker/build-push-action@v5
52
- with :
53
- context : .
54
- file : ./${{ matrix.config.dockerfile }}
55
- platforms : ${{ matrix.config.platform }}
56
- push : true
57
- tags : quay.io/redlib/redlib:${{ matrix.config.tag }}
58
- cache-from : type=gha
59
- cache-to : type=gha,mode=max
118
+ -
119
+ name : Inspect image
120
+ run : |
121
+ docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
122
+
0 commit comments