Skip to content

Commit 751763d

Browse files
fix: scan docker image on CVEs in CI (#1170)
Signed-off-by: Ilya Kheifets <ikheifets@splunk.com>
1 parent a5e3df0 commit 751763d

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

.github/workflows/ci-main.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,30 @@ jobs:
7272
with:
7373
python-version: "3.10"
7474
- uses: pre-commit/action@v3.0.1
75+
76+
trivy-scan:
77+
runs-on: ubuntu-latest
78+
name: "Run trivy scanner to detect CVEs in docker image"
79+
80+
steps:
81+
- name: Checkout code
82+
uses: actions/checkout@v4
83+
84+
- name: Set up Docker Buildx
85+
uses: docker/setup-buildx-action@v3
86+
87+
- name: Build Docker image
88+
run: |
89+
docker build -t snmp_local:ci .
90+
91+
- name: Scan image with Trivy
92+
uses: aquasecurity/trivy-action@master
93+
with:
94+
image-ref: snmp_local:ci
95+
format: table
96+
exit-code: 1
97+
severity: 'CRITICAL,HIGH,MEDIUM,LOW'
98+
7599
test-unit:
76100
name: Test Unit Python ${{ matrix.python-version }}
77101
runs-on: ubuntu-latest

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ FROM python:3.10-alpine AS base
33
ENV PYTHONFAULTHANDLER=1 \
44
PYTHONHASHSEED=random \
55
PYTHONUNBUFFERED=1
6-
RUN apk add -U git
6+
RUN apk add -U git sqlite-dev
7+
RUN pip install --upgrade setuptools pip
78
RUN mkdir /app
89
WORKDIR /app
910

0 commit comments

Comments
 (0)