Skip to content

Commit d8cc8f2

Browse files
committed
Enhance GitHub Actions workflow: added Docker build and export step, integrated Trivy vulnerability scanner for critical and high severity checks, and refined platform-specific build process. This update improves security scanning and image management.
1 parent 87f338e commit d8cc8f2

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

.github/workflows/service_docker-build-and-publish.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,30 @@ jobs:
7777
--print-tags-only
7878
fi
7979
80-
- name: Build and push
80+
- name: Build and export to Docker
81+
uses: docker/build-push-action@v6
82+
with:
83+
file: src/Dockerfile
84+
cache-from: type=gha,mode=max
85+
cache-to: type=gha,mode=max
86+
platforms: linux/amd64 # Only build amd64 for scanning
87+
pull: true
88+
push: false
89+
load: true # Load into Docker's local image store
90+
tags: ${{ env.DOCKER_TAGS }}
91+
92+
- name: Run Trivy vulnerability scanner
93+
uses: aquasecurity/trivy-action@0.29.0
94+
with:
95+
image-ref: ${{ env.DOCKER_TAGS }}
96+
format: 'table'
97+
exit-code: 1
98+
ignore-unfixed: true
99+
severity: 'CRITICAL,HIGH'
100+
hide-progress: true
101+
102+
- name: Build and push all platforms
103+
if: success()
81104
uses: docker/build-push-action@v6
82105
with:
83106
file: src/Dockerfile

0 commit comments

Comments
 (0)