Skip to content

Commit 7e6f2c0

Browse files
committed
ci: build & push debian based images to Dockerhub
1 parent e6ead3f commit 7e6f2c0

File tree

1 file changed

+45
-9
lines changed

1 file changed

+45
-9
lines changed

.github/workflows/dockerhub.yml

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,20 @@ on:
1919

2020
jobs:
2121
multiarch-build:
22+
strategy:
23+
matrix:
24+
base: [alpine, debian]
2225
runs-on: ubuntu-latest
26+
2327
steps:
24-
2528
- name: Checkout
2629
uses: actions/checkout@v2
2730
with:
2831
fetch-depth: 0
2932

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
3236
uses: crazy-max/ghaction-docker-meta@v2
3337
with:
3438
images: |
@@ -38,6 +42,20 @@ jobs:
3842
type=semver,pattern={{version}}
3943
type=semver,pattern={{major}}.{{minor}}
4044
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
4159

4260
- name: Retrieve version
4361
run: echo "VERSION=$(git describe --tags)" >> $GITHUB_ENV
@@ -54,15 +72,33 @@ jobs:
5472
username: ${{ secrets.DOCKERHUB_USERNAME }}
5573
password: ${{ secrets.DOCKERHUB_TOKEN }}
5674

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
5978
uses: docker/build-push-action@v2
6079
with:
6180
build-args: VERSION=${{ env.VERSION }}
6281
platforms: linux/amd64,linux/arm64,linux/arm/v7
6382
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 }}
6697

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

Comments
 (0)