-
Notifications
You must be signed in to change notification settings - Fork 124
62 lines (53 loc) · 1.76 KB
/
docker-image.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Build Docker image
on:
push:
tags:
- '*'
branches:
- "master"
paths-ignore:
- 'charts/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: image=moby/buildkit:v0.10.3,network=host
- name: Set Release Date
run: |
echo "BUILT_AT=$(date --rfc-3339=date)" >> ${GITHUB_ENV}
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
vectorized/kminion
redpandadata/kminion
# generate Docker tags based on the following events/attributes
# Semver type is only active on 'push tag' events, hence no enable condition required
tags: |
type=sha,prefix={{branch}}-,format=short,enable={{is_default_branch}}
type=semver,pattern={{raw}}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker_meta.outputs.tags }}
build-args: |
VERSION=${{ fromJSON(steps.docker_meta.outputs.json).labels['org.opencontainers.image.version'] }}
BUILT_AT=${{ env.BUILT_AT }}
COMMIT=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max