4646 with :
4747 category : " /language:go"
4848
49- trivy-repo :
50- name : Trivy Filesystem Scan
49+ trivy :
50+ name : Trivy Docker Image Scan
5151 runs-on : ubuntu-latest
5252 permissions :
5353 security-events : write
@@ -56,18 +56,44 @@ jobs:
5656 - name : Checkout repository
5757 uses : actions/checkout@v4
5858
59- - name : Run Trivy vulnerability scanner in repo mode
59+ - name : Setup Go
60+ uses : actions/setup-go@v5
61+ with :
62+ go-version-file : " go.mod"
63+
64+ - name : Build binary for linux/amd64
65+ run : |
66+ TAG=$(git describe --always)
67+ mkdir -p bin
68+ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
69+ -ldflags "-X github.com/coder/code-marketplace/buildinfo.tag=${TAG}" \
70+ -o bin/code-marketplace-linux-amd64 \
71+ ./cmd/marketplace/main.go
72+
73+ - name : Set up Docker Buildx
74+ uses : docker/setup-buildx-action@v3
75+
76+ - name : Build Docker image
77+ id : build
78+ run : |
79+ docker buildx build \
80+ --platform linux/amd64 \
81+ --tag code-marketplace:scan \
82+ --load \
83+ --build-arg TARGETARCH=amd64 \
84+ .
85+ echo "image=code-marketplace:scan" >> "$GITHUB_OUTPUT"
86+
87+ - name : Run Trivy vulnerability scanner
6088 uses :
aquasecurity/[email protected] 6189 with :
62- scan-type : " fs"
63- scan-ref : " ."
90+ image-ref : ${{ steps.build.outputs.image }}
6491 format : " sarif"
6592 output : " trivy-results.sarif"
6693 severity : " LOW,MEDIUM,HIGH,CRITICAL"
67- scanners : " vuln,secret,misconfig"
6894
6995 - name : Upload Trivy scan results to GitHub Security tab
7096 uses : github/codeql-action/upload-sarif@v3
7197 with :
7298 sarif_file : " trivy-results.sarif"
73- category : " Trivy-Filesystem "
99+ category : " Trivy"
0 commit comments