-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (44 loc) · 1.31 KB
/
build-docker-images.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
name: Build Docker Images
on:
push:
branches:
- master
- main
- 'v*'
workflow_dispatch:
jobs:
build:
runs-on: [self-hosted, Linux, alibaba-cloud]
defaults:
run:
shell: bash
steps:
- name: "Checking out code"
uses: actions/checkout@v2
with:
submodules: recursive
- name: "Login to DockerHub"
uses: docker/login-action@v2
with:
registry: ${{ secrets.DOCKER_REGISTRY_ADDRESS }}
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: "Set up QEMU"
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:master
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v1
- name: "Building docker images"
run: |
image="${{ secrets.DOCKER_REGISTRY_ADDRESS }}/cita-cloud/$(basename ${GITHUB_REPOSITORY})"
tag=${GITHUB_REF#refs/heads/}
if [ "$tag" = 'master' ] || [ "$tag" = 'main' ]; then
tag=latest
fi
docker buildx build \
--output "type=image,push=true" \
--file "Dockerfile" \
--tag "${image}:${tag}" \
--platform "linux/amd64" \
"."