Skip to content

Commit 2024a2f

Browse files
authored
Merge pull request #347 from buchdag/github-actions-build
Build multi arch images on GitHub Actions and push to DockerHub
2 parents c830c3f + 33a2d63 commit 2024a2f

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

.github/workflows/dockerhub.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: DockerHub
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 0 * * 1'
7+
push:
8+
branches:
9+
- master
10+
tags:
11+
- '*.*.*'
12+
paths:
13+
- '.dockerignore'
14+
- '.github/workflows/dockerhub.yml'
15+
- 'Dockerfile'
16+
- 'go.mod'
17+
- 'go.sum'
18+
- '**.go'
19+
20+
jobs:
21+
multiarch-build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Get Docker tags
31+
id: docker_meta
32+
uses: crazy-max/ghaction-docker-meta@v2
33+
with:
34+
images: jwilder/docker-gen
35+
tags: |
36+
type=semver,pattern={{version}}
37+
type=semver,pattern={{major}}.{{minor}}
38+
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
39+
40+
- name: Set up QEMU
41+
uses: docker/setup-qemu-action@v1
42+
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v1
45+
46+
- name: Login to DockerHub
47+
uses: docker/login-action@v1
48+
with:
49+
username: ${{ secrets.DOCKERHUB_USERNAME }}
50+
password: ${{ secrets.DOCKERHUB_TOKEN }}
51+
52+
- name: Build and push
53+
id: docker_build
54+
uses: docker/build-push-action@v2
55+
with:
56+
platforms: linux/amd64,linux/arm64,linux/arm/v7
57+
push: true
58+
tags: ${{ steps.docker_meta.outputs.tags }}
59+
labels: ${{ steps.docker_meta.outputs.labels }}
60+
61+
- name: Image digest
62+
run: echo ${{ steps.docker_build.outputs.digest }}

0 commit comments

Comments
 (0)