Skip to content

Commit f269999

Browse files
ci: add Trivy and Dive to PR workflow
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 88da58a commit f269999

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

.github/workflows/ci.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
dockerfile: Containerfile
3131

3232
build:
33-
name: Test build
33+
name: Build and scan
3434
runs-on: ubuntu-latest
3535
needs: [hadolint]
3636
steps:
@@ -49,3 +49,28 @@ jobs:
4949
done
5050
# shellcheck disable=SC2086
5151
docker build -f Containerfile ${BUILD_ARGS} -t test-build .
52+
53+
- name: Install Dive
54+
run: |
55+
DIVE_VERSION=0.12.0
56+
curl -sSL -o /tmp/dive.deb "https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_amd64.deb"
57+
sudo apt install -y /tmp/dive.deb
58+
rm /tmp/dive.deb
59+
60+
- name: Dive filesystem scan
61+
run: dive --ci --source=docker test-build
62+
63+
- name: Cache Trivy vulnerability DB
64+
uses: actions/cache@v4
65+
with:
66+
path: ~/.cache/trivy
67+
key: trivy-db-${{ runner.os }}-${{ github.run_id }}
68+
restore-keys: |
69+
trivy-db-${{ runner.os }}-
70+
71+
- name: Trivy vulnerability scan
72+
uses: aquasecurity/trivy-action@0.24.0
73+
with:
74+
image-ref: test-build
75+
severity: 'HIGH,CRITICAL'
76+
exit-code: '1'

0 commit comments

Comments
 (0)