Skip to content

Commit 4803a70

Browse files
committed
ci: add docker security scan and lint workflow
1 parent 2d0ef19 commit 4803a70

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

.github/workflows/docker-lint.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Docker lint
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
push:
6+
branches: [ main ]
7+
8+
jobs:
9+
lint:
10+
name: Lint Dockerfiles
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.x'
20+
21+
- name: Install yamllint
22+
run: pip install yamllint
23+
24+
- name: Find and run yamllint on compose files
25+
run: |
26+
set -euo pipefail
27+
files=$(git ls-files "**/docker-compose*.yml" "**/docker-compose*.yaml" || true)
28+
if [ -n "$files" ]; then
29+
echo "$files" | xargs yamllint || true
30+
else
31+
echo "No compose files found"
32+
fi

.github/workflows/docker-scan.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Docker security scan
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
push:
6+
branches: [ main ]
7+
8+
jobs:
9+
trivy-scan:
10+
name: Run Trivy filesystem scan
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Run Trivy Action
16+
uses: aquasecurity/trivy-action@0.32.0
17+
with:
18+
format: 'table'
19+
scan-type: 'fs'
20+
severity: 'HIGH,CRITICAL'
21+
exit-code: '1'
22+
ignore-unfixed: true

0 commit comments

Comments
 (0)