-
Notifications
You must be signed in to change notification settings - Fork 46
46 lines (38 loc) · 1.21 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
name: docker
on:
push:
tags:
- '*'
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- uses: olegtarasov/get-tag@v2.1
id: tagName
- name: Build image
env:
TAGNAME: ${{ steps.tagName.outputs.tag }}
run: docker build --build-arg BUILD_VERSION=$TAGNAME --pull -t kooldev/kool:$TAGNAME -t kooldev/kool:4scan .
- name: Test image
env:
TAGNAME: ${{ steps.tagName.outputs.tag }}
run: docker run kooldev/kool:$TAGNAME kool --version
# - name: Scan image
# uses: anchore/scan-action@v2
# with:
# image: "kooldev/kool:4scan"
# fail-build: true
# severity-cutoff: critical
- name: Push to hub
env:
TAGNAME: ${{ steps.tagName.outputs.tag }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
TAGNAME_MAJOR=${TAGNAME%%.*}
docker tag kooldev/kool:$TAGNAME kooldev/kool:$TAGNAME_MAJOR
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
docker push kooldev/kool:$TAGNAME
docker push kooldev/kool:$TAGNAME_MAJOR