@@ -35,41 +35,25 @@ jobs:
35
35
- name : Retrieve version
36
36
run : echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV
37
37
38
- - name : Get Docker tags for Alpine based image
39
- if : ${{ matrix.base == 'alpine' }}
40
- id : docker_meta_alpine
38
+ - name : Get Docker tags
39
+ id : docker_meta
41
40
uses : docker/metadata-action@v4
42
41
with :
43
42
images : |
44
43
ghcr.io/nginx-proxy/docker-gen
45
44
nginxproxy/docker-gen
46
45
jwilder/docker-gen
47
46
tags : |
48
- type=semver,pattern={{version}}
49
- type=semver,pattern={{major}}.{{minor}}
50
- type=raw,value=latest,enable={{is_default_branch}}
47
+ type=semver,pattern={{version}},enable=${{ matrix.base == 'alpine' }}
48
+ type=semver,pattern={{major}}.{{minor}},enable=${{ matrix.base == 'alpine' }}
49
+ type=semver,suffix=-debian,pattern={{version}},enable=${{ matrix.base == 'debian' }}
50
+ type=semver,suffix=-debian,pattern={{major}}.{{minor}},enable=${{ matrix.base == 'debian' }}
51
+ type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.base == 'alpine' }}
52
+ type=raw,value=debian,enable=${{ github.ref == 'refs/heads/main' && matrix.base == 'debian' }}
51
53
labels : |
52
54
org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
53
55
org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
54
56
55
- - name : Get Docker tags for Debian based image
56
- if : ${{ matrix.base == 'debian' }}
57
- id : docker_meta_debian
58
- uses : docker/metadata-action@v4
59
- with :
60
- images : |
61
- ghcr.io/nginx-proxy/docker-gen
62
- nginxproxy/docker-gen
63
- jwilder/docker-gen
64
- tags : |
65
- type=semver,suffix=-debian,pattern={{version}}
66
- type=semver,suffix=-debian,pattern={{major}}.{{minor}}
67
- type=raw,value=debian,enable={{is_default_branch}}
68
- labels : |
69
- org.opencontainers.image.authors=Nicolas Duchon <nicolas.duchon@gmail.com> (@buchdag), Jason Wilder
70
- org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
71
- flavor : latest=false
72
-
73
57
- name : Set up QEMU
74
58
uses : docker/setup-qemu-action@v2
75
59
@@ -89,35 +73,17 @@ jobs:
89
73
username : ${{ github.actor }}
90
74
password : ${{ secrets.GITHUB_TOKEN }}
91
75
92
- - name : Build and push the Alpine based image
93
- if : ${{ matrix.base == 'alpine' }}
94
- id : docker_build_alpine
76
+ - name : Build and push the image
77
+ id : docker_build
95
78
uses : docker/build-push-action@v4
96
79
with :
97
80
context : .
98
81
build-args : DOCKER_GEN_VERSION=${{ env.GIT_DESCRIBE }}
99
82
platforms : linux/amd64,linux/arm64,linux/arm/v7
83
+ file : Dockerfile.${{ matrix.base }}
100
84
push : true
101
- tags : ${{ steps.docker_meta_alpine.outputs.tags }}
102
- labels : ${{ steps.docker_meta_alpine.outputs.labels }}
103
-
104
- - name : Build and push the Debian based image
105
- if : ${{ matrix.base == 'debian' }}
106
- id : docker_build_debian
107
- uses : docker/build-push-action@v4
108
- with :
109
- context : .
110
- build-args : DOCKER_GEN_VERSION=${{ env.GIT_DESCRIBE }}
111
- file : Dockerfile.debian
112
- platforms : linux/amd64,linux/arm64,linux/arm/v7
113
- push : true
114
- tags : ${{ steps.docker_meta_debian.outputs.tags }}
115
- labels : ${{ steps.docker_meta_debian.outputs.labels }}
116
-
117
- - name : Alpine based image digest
118
- if : ${{ matrix.base == 'alpine' }}
119
- run : echo ${{ steps.docker_build_alpine.outputs.digest }}
85
+ tags : ${{ steps.docker_meta.outputs.tags }}
86
+ labels : ${{ steps.docker_meta.outputs.labels }}
120
87
121
- - name : Debian based image digest
122
- if : ${{ matrix.base == 'debian' }}
123
- run : echo ${{ steps.docker_build_debian.outputs.digest }}
88
+ - name : Docker image digest
89
+ run : echo ${{ steps.docker_build.outputs.digest }}
0 commit comments