forked from 0akash0/node-js-sample-akash
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (59 loc) · 1.96 KB
/
main.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
name: Build, Push, and Deploy
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- uses: actions/checkout@v2
- name: Set env
run: echo "GITHUB_BRANCH=$(echo $GITHUB_REF_NAME-$GITHUB_SHA)" >> $GITHUB_ENV
- name: Build Docker image
run: |
docker buildx create --use
docker buildx inspect default --bootstrap
docker buildx build --file Dockerfile -t mhaidir32/node-js-sample-akash:$GITHUB_REF_NAME-$GITHUB_SHA --load .
container_scanning:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: build local container
uses: docker/build-push-action@v2
with:
tags: mhaidir32/node-js-sample-akash:${{ github.sha }}
push: false
load: true
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'mhaidir32/node-js-sample-akash:${{ github.sha }}'
format: 'sarif'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
output: 'trivy-results.sarif'
continue-on-error: true
- name: Display structure of downloaded files
run: ls -lah
- name: display path
run: pwd
- name: download artifact
uses: actions/download-artifact@v4
with:
path: .
name: 'trivy-results.sarif'
- name: Upload Trivy SARIF Report
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'