@@ -35,41 +35,25 @@ jobs:
3535 - name : Retrieve version
3636 run : echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV
3737
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
4140 uses : docker/metadata-action@v4
4241 with :
4342 images : |
4443 ghcr.io/nginx-proxy/docker-gen
4544 nginxproxy/docker-gen
4645 jwilder/docker-gen
4746 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' }}
5153 labels : |
5254 org.opencontainers.image.authors=Nicolas Duchon <[email protected] > (@buchdag), Jason Wilder 5355 org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
5456
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
72-
7357 - name : Set up QEMU
7458 uses : docker/setup-qemu-action@v2
7559
@@ -89,35 +73,17 @@ jobs:
8973 username : ${{ github.actor }}
9074 password : ${{ secrets.GITHUB_TOKEN }}
9175
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
9578 uses : docker/build-push-action@v4
9679 with :
9780 context : .
9881 build-args : DOCKER_GEN_VERSION=${{ env.GIT_DESCRIBE }}
9982 platforms : linux/amd64,linux/arm64,linux/arm/v7
83+ file : Dockerfile.${{ matrix.base }}
10084 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 }}
12087
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