-
Notifications
You must be signed in to change notification settings - Fork 305
85 lines (74 loc) · 2.67 KB
/
docker.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: docker-nightly
on:
push:
branches:
- main
tags:
- '*.*.*'
pull_request:
jobs:
docker:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.19.x"
- name: Checkout code
uses: actions/checkout@v2
- name: Get Build Data
id: info
run: |
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
export TEMP=$(cd auth_server && go run gen_version.go)
echo ::set-output name=version::$(echo -n $TEMP | awk '{print $1}')
echo ::set-output name=build_id::$(echo -n $TEMP | awk '{print $2}')
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: cesanta/docker_auth
tag-edge: true
tag-semver: |
{{version}}
{{major}}
{{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
# TODO: Remove driver-opts once fix is released docker/buildx#386
driver-opts: image=moby/buildkit:master
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: github.event_name == 'push'
- name: Build and Push
uses: docker/build-push-action@v2
with:
context: auth_server
file: auth_server/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.docker_meta.outputs.tags }}
build-args: |
VERSION=${{ steps.info.outputs.version }}
BUILD_ID=${{ steps.info.outputs.build_id }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.version=${{ steps.imagetag.outputs.value }}
org.opencontainers.image.created=${{ steps.info.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}