forked from clouddrove/github-shared-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (81 loc) · 2.45 KB
/
Copy pathdocker-scout.yml
File metadata and controls
88 lines (81 loc) · 2.45 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
name: 🔍 docker-scout
on:
workflow_call:
inputs:
IMAGES:
description: 'Dockerhub repository name'
required: true
type: string
IMAGE_TAG:
description: 'Image tag for latest docker image'
type: string
default: latest
COMPARE_TAG:
description: 'provide the tag of the image you like to compare with'
required: true
type: string
# Filter flags
IGNORE-BASE:
description: 'Ignore vulnerabilities from base image'
default: false
type: string
IGNORE-UNCHANGED:
description: 'Filter out unchanged packages'
default: true
type: string
ONLY-FIXED:
description: 'Filter to fixable CVEs'
default: false
type: string
WRITE-COMMENT:
description: 'Write the output as a Pull Request comment'
default: true
type: string
secrets:
DOCKERHUB_USERNAME:
description: 'dockerhub username'
required: true
DOCKERHUB_PASSWORD:
description: 'dockerhub password'
required: true
TOKEN:
description: 'Github Token'
required: true
jobs:
docker-scout:
runs-on: ubuntu-latest
steps:
- name: 📦 Checkout Repository
uses: actions/checkout@v7
- name: ⚙️ Setup Docker buildx
uses: docker/setup-buildx-action@v4.1.0
with:
driver-opts: |
image=moby/buildkit:v0.10.6
- name: 🔐 Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: 🛠️ Build docker image
env:
IMAGE_TAG: ${{ inputs.IMAGE_TAG }}
images: ${{ inputs.IMAGES }}
run: |
docker build -t $images:$IMAGE_TAG .
# docker push $images:$IMAGE_TAG
- name: 🕵️ Docker Scout
id: docker-scout
uses: docker/scout-action@v1
with:
command: cves,recommendations,compare
to-latest: false
to: ${{ inputs.IMAGES }}:${{ inputs.COMPARE_TAG }}
image: ${{ inputs.IMAGES }}:${{ inputs.IMAGE_TAG }}
ignore-base: ${{ inputs.IGNORE-BASE }}
ignore-unchanged: ${{ inputs.IGNORE-BASE }}
only-fixed: ${{ inputs.ONLY-FIXED }}
write-comment: ${{ inputs.WRITE-COMMENT }}
github-token: ${{ secrets.TOKEN }}
...