@@ -33,42 +33,29 @@ jobs:
33
33
fetch-depth : 0
34
34
35
35
- name : Retrieve version
36
- run : echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV
36
+ id : docker-gen_version
37
+ run : echo "VERSION=$(git describe --tags)" >> "$GITHUB_OUTPUT"
37
38
38
- - name : Get Docker tags for Alpine based image
39
- if : ${{ matrix.base == 'alpine' }}
40
- id : docker_meta_alpine
39
+ - name : Get Docker tags
40
+ id : docker_meta
41
41
uses : docker/metadata-action@v4
42
42
with :
43
43
images : |
44
44
ghcr.io/nginx-proxy/docker-gen
45
45
nginxproxy/docker-gen
46
46
jwilder/docker-gen
47
47
tags : |
48
- type=semver,pattern={{version}}
49
- type=semver,pattern={{major}}.{{minor}}
50
- type=raw,value=latest,enable={{is_default_branch}}
48
+ type=semver,pattern={{version}},enable=${{ matrix.base == 'alpine' }}
49
+ type=semver,pattern={{major}}.{{minor}},enable=${{ matrix.base == 'alpine' }}
50
+ type=semver,suffix=-debian,pattern={{version}},enable=${{ matrix.base == 'debian' }}
51
+ type=semver,suffix=-debian,pattern={{major}}.{{minor}},enable=${{ matrix.base == 'debian' }}
52
+ type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' && matrix.base == 'alpine' }}
53
+ type=raw,value=debian,enable=${{ github.ref == 'refs/heads/main' && matrix.base == 'debian' }}
51
54
labels : |
52
55
org.opencontainers.image.authors=Nicolas Duchon <[email protected] > (@buchdag), Jason Wilder
53
- org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
54
-
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 <[email protected] > (@buchdag), Jason Wilder
70
- org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
71
- flavor : latest=false
56
+ org.opencontainers.image.version=${{ steps.docker-gen_version.outputs.VERSION }}
57
+ flavor : |
58
+ latest=false
72
59
73
60
- name : Set up QEMU
74
61
uses : docker/setup-qemu-action@v2
@@ -89,35 +76,19 @@ jobs:
89
76
username : ${{ github.actor }}
90
77
password : ${{ secrets.GITHUB_TOKEN }}
91
78
92
- - name : Build and push the Alpine based image
93
- if : ${{ matrix.base == 'alpine' }}
94
- id : docker_build_alpine
95
- uses : docker/build-push-action@v4
96
- with :
97
- context : .
98
- build-args : DOCKER_GEN_VERSION=${{ env.GIT_DESCRIBE }}
99
- platforms : linux/amd64,linux/arm64,linux/arm/v7
100
- 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
79
+ - name : Build and push the image
80
+ id : docker_build
107
81
uses : docker/build-push-action@v4
108
82
with :
109
83
context : .
110
- build-args : DOCKER_GEN_VERSION=${{ env.GIT_DESCRIBE }}
111
- file : Dockerfile.debian
112
- platforms : linux/amd64,linux/arm64,linux/arm/v7
84
+ build-args : DOCKER_GEN_VERSION=${{ steps.docker-gen_version.outputs.VERSION }}
85
+ platforms : linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
86
+ file : Dockerfile.${{ matrix.base }}
113
87
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 }}
88
+ tags : ${{ steps.docker_meta.outputs.tags }}
89
+ labels : ${{ steps.docker_meta.outputs.labels }}
90
+ cache-from : type=gha
91
+ cache-to : type=gha,mode=max
120
92
121
- - name : Debian based image digest
122
- if : ${{ matrix.base == 'debian' }}
123
- run : echo ${{ steps.docker_build_debian.outputs.digest }}
93
+ - name : Docker image digest
94
+ run : echo ${{ steps.docker_build.outputs.digest }}
0 commit comments