Skip to content

Commit 2ee005a

Browse files
committed
feat: add trivy image with pre-downloaded db
Signed-off-by: Jesse Suen <jesse@akuity.io>
1 parent 748880f commit 2ee005a

4 files changed

Lines changed: 52 additions & 1 deletion

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release Trivy
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Image tag (e.g. 1.2.3)"
8+
required: true
9+
type: string
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
steps:
18+
- uses: actions/checkout@v6
19+
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v4
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v4
25+
26+
- name: Log in to GitHub Container Registry
27+
uses: docker/login-action@v4
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Build and push
34+
uses: docker/build-push-action@v7
35+
with:
36+
context: docker/trivy
37+
platforms: linux/amd64,linux/arm64
38+
push: true
39+
build-args: |
40+
TRIVY_VERSION=${{ inputs.tag }}
41+
tags: ghcr.io/${{ github.repository_owner }}/trivy:${{ inputs.tag }}

docker/trivy/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ARG TRIVY_VERSION=latest
2+
FROM aquasec/trivy:${TRIVY_VERSION}
3+
4+
# Download the vulnerability DB at build time
5+
RUN trivy image --download-db-only

docker/trivy/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Trivy Image
2+
3+
This is a trivy image with the database pre-downloaded, in order to avoid downloading the
4+
database every time a custom executes.

kargo/custom-steps/trivy-image/trivy-image.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ kind: CustomPromotionStep
33
metadata:
44
name: trivy-image
55
spec:
6-
image: aquasec/trivy:0.69.3
6+
image: ghcr.io/jessesuen/trivy:0.69.3
77
command:
88
- trivy
99
- image
1010
- --exit-code=1
1111
- --severity=CRITICAL
1212
- --disable-telemetry
13+
- --skip-db-update
1314
- --scanners=vuln
1415
- ${{ config.image }}

0 commit comments

Comments
 (0)