-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (51 loc) · 1.42 KB
/
Copy pathbuild.yaml
File metadata and controls
59 lines (51 loc) · 1.42 KB
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
name: BuildPipeline
on:
push:
branches:
- "pre-release"
- "master"
jobs:
init:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: GatherCommitSHA
id: init
run: |
export IMAGE_TAG=$(git rev-parse --short HEAD)
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_OUTPUT
outputs:
image_tag: ${{ steps.init.outputs.IMAGE_TAG }}
docker:
runs-on: ubuntu-latest
needs: [init]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.REPO_OWNER }}
password: ${{ secrets.REPO_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
file: docker/Dockerfile
push: true
tags: |
emirozbir/tcp-exporter:latest
emirozbir/tcp-exporter:${{needs.init.outputs.image_tag}}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: emirozbir/tcp-exporter:latest
format: 'table'
exit-code: '0'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'