-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tom Morelly
committed
Feb 2, 2024
1 parent
32cd106
commit 0a091db
Showing
4 changed files
with
63 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: image_scan | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.20' | ||
cache: false | ||
|
||
- run: go generate -tags tools tools/tools.go | ||
|
||
- name: go get | ||
run: go get ./... | ||
|
||
- name: go build | ||
run: go build -o vault-kubernetes-kms cmd/main.go | ||
|
||
- uses: hadolint/hadolint-action@v3.1.0 | ||
with: | ||
dockerfile: Dockerfile | ||
|
||
- name: Build an image from Dockerfile | ||
run: | | ||
docker build -t docker.io/falcosuessgott/vault-kubernetes-kms:${{ github.sha }} . | ||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: 'docker.io/falcosuessgott/vault-kubernetes-kms:${{ github.sha }}' | ||
format: 'table' | ||
exit-code: '1' | ||
ignore-unfixed: true | ||
vuln-type: 'os,library' | ||
severity: 'CRITICAL,HIGH' | ||
output: trivy-results.sarif | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: trivy-results.sarif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
FROM alpine:3.19 | ||
FROM golang:1.20 as builder | ||
WORKDIR /app | ||
COPY . . | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o vault-kubernetes-kms cmd/main.go | ||
|
||
COPY vault-kubernetes-kms /usr/bin/vault-kubernetes-kms | ||
FROM gcr.io/distroless/static-debian12 | ||
WORKDIR / | ||
COPY --from=builder /app/vault-kubernetes-kms . | ||
|
||
ENTRYPOINT ["/usr/bin/vault-kubernetes-kms"] | ||
ENTRYPOINT ["/vault-kubernetes-kms"] |