1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-02 19:55:18 +02:00

feat(security): add Trivy security scans for Docker images and source code

This commit is contained in:
Sean Morley 2025-06-23 08:15:51 -04:00
parent dc67ad1156
commit 12a5221b76

View 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