mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-04 04:35:19 +02:00
feat(security): add Trivy security scans for Docker images and source code
This commit is contained in:
parent
dc67ad1156
commit
12a5221b76
1 changed files with 52 additions and 0 deletions
52
.github/workflows/trivy_security_scans.yml
vendored
Normal file
52
.github/workflows/trivy_security_scans.yml
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
name: Trivy Security Scans
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- development
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- development
|
||||||
|
schedule:
|
||||||
|
- cron: "0 8 * * 1" # Weekly scan on Mondays at 8 AM UTC
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
trivy-scan:
|
||||||
|
name: Trivy Filesystem & Docker Image Scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx (for consistent image builds)
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry (optional, if pushing images)
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
run: docker build -t adventurelog:latest .
|
||||||
|
|
||||||
|
- name: Scan Docker image with Trivy
|
||||||
|
uses: aquasecurity/trivy-action@master
|
||||||
|
with:
|
||||||
|
image-ref: adventurelog:latest
|
||||||
|
format: table
|
||||||
|
exit-code: 1
|
||||||
|
ignore-unfixed: true
|
||||||
|
|
||||||
|
- name: Scan source code (Filesystem) with Trivy
|
||||||
|
uses: aquasecurity/trivy-action@master
|
||||||
|
with:
|
||||||
|
scan-type: fs
|
||||||
|
scan-ref: .
|
||||||
|
format: table
|
||||||
|
exit-code: 1
|
||||||
|
ignore-unfixed: true
|
Loading…
Add table
Add a link
Reference in a new issue