-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (61 loc) · 1.9 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
name: Docker
on:
push:
tags:
- 'v*'
branches:
- master
- test
concurrency:
group: docker-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Build and push image
env:
RELEASE_VERSION: ${{ steps.github.outputs.tag }}
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/kms-decypter
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
if [ "$VERSION" == "latest" ]; then
UBUNTU_IMAGE=$IMAGE_ID:latest
ALPINE_IMAGE=$IMAGE_ID:alpine
else
UBUNTU_IMAGE=$IMAGE_ID:$VERSION
ALPINE_IMAGE=$IMAGE_ID:alpine-$VERSION
fi
docker buildx build . \
--platform linux/arm64,linux/amd64 \
--build-arg GOLANG_BASE_IMAGE=golang:1.18-alpine \
--build-arg RELEASE_IMAGE=alpine:3.15 \
--push \
--progress plain \
-f build/Dockerfile \
--tag $ALPINE_IMAGE \
docker buildx build . \
--platform linux/arm64,linux/amd64 \
--build-arg GOLANG_BASE_IMAGE=golang:1.18 \
--build-arg RELEASE_IMAGE=ubuntu:latest \
--push \
--progress plain \
-f build/Dockerfile \
--tag $UBUNTU_IMAGE \