-
Notifications
You must be signed in to change notification settings - Fork 6
52 lines (46 loc) · 1.39 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
name: Docker Image CI
on:
push:
branches:
- main
pull_request:
branches:
- '*'
env:
REGISTRY: docker.io
IMAGE_NAME: learnwithsagar
SHA: ${{ github.event.pull_request.head.sha || github.event.after }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ env.SHA }}
- name: Setup Docker buildx
uses: docker/[email protected]
with:
driver-opts: |
image=moby/buildkit:v0.10.6
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build the Docker image
run: docker build . --file ./dockerday01/Dockerfile --tag learnwithsagar/node-app:${{ github.sha }}
- name: Docker Push
run: docker push learnwithsagar/node-app:${{ github.sha }}
- name: Docker Scout
id: docker-scout
if: ${{ github.event_name == 'pull_request' }}
uses: docker/scout-action@dd36f5b0295baffa006aa6623371f226cc03e506
with:
command: cves
image: learnwithsagar/node-app:${{ github.sha }}
only-severities: critical,high
exit-code: true