This commit is contained in:
Johan
2026-02-04 11:52:22 +01:00
parent d6f1cd0360
commit 0004fa1895
5 changed files with 201 additions and 4 deletions

View File

@@ -55,3 +55,90 @@ jobs:
- name: Run tests
run: |
if [ -d backend/tests ]; then pytest -q; else echo "No tests found"; fi
docker-lint:
name: Docker Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Hadolint on backend Dockerfile
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: backend/Dockerfile
ignore: DL3045
- name: Run Hadolint on frontend Dockerfile
uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: frontend/Dockerfile
ignore: DL3045
build-and-scan:
name: Build and Scan Docker Images
needs: docker-lint
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build backend image
uses: docker/build-push-action@v5
with:
context: ./backend
file: ./backend/Dockerfile
push: false
load: true
tags: backend:latest
- name: Build frontend image
uses: docker/build-push-action@v5
with:
context: ./frontend
file: ./frontend/Dockerfile
push: false
load: true
tags: frontend:latest
- name: Scan backend with Trivy
uses: aquasecurity/trivy-action@master
with:
image-ref: backend:latest
format: sarif
output: backend-trivy.sarif
- name: Scan frontend with Trivy
uses: aquasecurity/trivy-action@master
with:
image-ref: frontend:latest
format: sarif
output: frontend-trivy.sarif
- name: Upload Trivy results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: backend-trivy.sarif
- name: Upload frontend Trivy results
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: frontend-trivy.sarif
validate-docker-compose:
name: Validate Docker Compose
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate docker-compose.yml
run: |
docker-compose -f docker-compose.yml config > /dev/null
continue-on-error: true