19
19
20
20
jobs :
21
21
multiarch-build :
22
+ strategy :
23
+ matrix :
24
+ base : [alpine, debian]
22
25
runs-on : ubuntu-latest
26
+
23
27
steps :
24
-
25
28
- name : Checkout
26
29
uses : actions/checkout@v2
27
30
with :
28
31
fetch-depth : 0
29
32
30
- - name : Get Docker tags
31
- id : docker_meta
33
+ - name : Get Docker tags for Alpine based image
34
+ if : ${{ matrix.base == 'alpine' }}
35
+ id : docker_meta_alpine
32
36
uses : crazy-max/ghaction-docker-meta@v2
33
37
with :
34
38
images : |
38
42
type=semver,pattern={{version}}
39
43
type=semver,pattern={{major}}.{{minor}}
40
44
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
45
+
46
+ - name : Get Docker tags for Debian based image
47
+ if : ${{ matrix.base == 'debian' }}
48
+ id : docker_meta_debian
49
+ uses : crazy-max/ghaction-docker-meta@v2
50
+ with :
51
+ images : |
52
+ nginxproxy/docker-gen
53
+ jwilder/docker-gen
54
+ tags : |
55
+ type=semver,suffix=-debian,pattern={{version}}
56
+ type=semver,suffix=-debian,pattern={{major}}.{{minor}}
57
+ type=raw,value=debian,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
58
+ flavor : latest=false
41
59
42
60
- name : Retrieve version
43
61
run : echo "VERSION=$(git describe --tags)" >> $GITHUB_ENV
@@ -54,15 +72,33 @@ jobs:
54
72
username : ${{ secrets.DOCKERHUB_USERNAME }}
55
73
password : ${{ secrets.DOCKERHUB_TOKEN }}
56
74
57
- - name : Build and push
58
- id : docker_build
75
+ - name : Build and push the Alpine based image
76
+ if : ${{ matrix.base == 'alpine' }}
77
+ id : docker_build_alpine
59
78
uses : docker/build-push-action@v2
60
79
with :
61
80
build-args : VERSION=${{ env.VERSION }}
62
81
platforms : linux/amd64,linux/arm64,linux/arm/v7
63
82
push : true
64
- tags : ${{ steps.docker_meta.outputs.tags }}
65
- labels : ${{ steps.docker_meta.outputs.labels }}
83
+ tags : ${{ steps.docker_meta_alpine.outputs.tags }}
84
+ labels : ${{ steps.docker_meta_alpine.outputs.labels }}
85
+
86
+ - name : Build and push the Debian based image
87
+ if : ${{ matrix.base == 'debian' }}
88
+ id : docker_build_debian
89
+ uses : docker/build-push-action@v2
90
+ with :
91
+ build-args : VERSION=${{ env.VERSION }}
92
+ file : Dockerfile.debian
93
+ platforms : linux/amd64,linux/arm64,linux/arm/v7
94
+ push : true
95
+ tags : ${{ steps.docker_meta_debian.outputs.tags }}
96
+ labels : ${{ steps.docker_meta_debian.outputs.labels }}
66
97
67
- - name : Image digest
68
- run : echo ${{ steps.docker_build.outputs.digest }}
98
+ - name : Alpine based image digest
99
+ if : ${{ matrix.base == 'alpine' }}
100
+ run : echo ${{ steps.docker_build_alpine.outputs.digest }}
101
+
102
+ - name : Debian based image digest
103
+ if : ${{ matrix.base == 'debian' }}
104
+ run : echo ${{ steps.docker_build_debian.outputs.digest }}
0 commit comments