-
Notifications
You must be signed in to change notification settings - Fork 1.1k
57 lines (56 loc) · 1.79 KB
/
build-docker-image.yml
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
name: Push Image To Docker Hub
on:
push:
tags:
- mockserver-*
workflow_dispatch:
inputs:
tag:
description: 'comma separated list of full docker tags, i.e. mockserver/mockserver:mockserver-5.15.0,mockserver/mockserver:5.15.0,mockserver/mockserver:latest'
required: true
default: ''
jobs:
build-and-push-docker:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: get tags
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
mockserver/mockserver
# generate Docker tags based on the following events/attributes
tags: |
type=match,pattern=(.*),group=1
type=match,pattern=mockserver-(.*),group=1
# type=raw,value=latest,enable=false
- name: set up QEMU
uses: docker/setup-qemu-action@v2
- name: set up docker buildx
uses: docker/setup-buildx-action@v2
- name: login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: build and push (tag override)
if: inputs.tag != ''
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ inputs.tag }}
- name: build and push (tag from release)
if: inputs.tag == ''
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}