Skip to content

Commit 073f41a

Browse files
committed
[dev] add trivy in task for testing image vulnerabilities
1 parent 5794264 commit 073f41a

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

.github/workflows/security.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ jobs:
3434
env:
3535
TRIVY_TIMEOUT: 5m
3636
TRIVY_IGNORE_UNFIXED: true
37+
TRIVY_DISABLE_VEX_NOTICE: true

Dockerfile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ COPY --from=ghcr.io/mlocati/php-extension-installer:2.8 /usr/bin/install-php-ext
88

99
ENV COMPOSER_ALLOW_SUPERUSER=1
1010

11-
RUN <<EOT sh
12-
set -ex
13-
apt-get update
14-
apt-get install -y libexpat1=2.5.0-1+deb12u1 libgstreamer1.0-0=1.22.0-2+deb12u1
15-
EOT
16-
1711
RUN <<EOT sh
1812
set -ex
1913
install-php-extensions mysqli \

Taskfile.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,33 @@ tasks:
5757
bake:
5858
desc: Bake
5959
vars:
60-
PHP_VERSIONS: '{{ .pv | default "8.1.33,8.2.29,8.3.24,8.4.11"}}'
60+
PHP_VERSIONS: '{{ .pv | default "8.1.33,8.2.29,8.3.25,8.4.12"}}'
6161
cmds:
6262
- PHP_VERSIONS={{.PHP_VERSIONS}} docker buildx bake --set *.platform=linux/amd64
6363

6464
bake:print:
6565
desc: Bake print options without building
6666
vars:
67-
PHP_VERSIONS: '{{ .pv | default "8.1.33,8.2.29,8.3.24,8.4.11"}}'
67+
PHP_VERSIONS: '{{ .pv | default "8.1.33,8.2.29,8.3.25,8.4.12"}}'
6868
cmds:
6969
- PHP_VERSIONS={{.PHP_VERSIONS}} docker buildx bake --print | $JQ
70+
71+
# trivy
72+
trivy:
73+
desc: Trivy
74+
vars:
75+
TRIVY_VERSION: '{{ .tv | default "latest" }}'
76+
PHP_BASE: '{{ .pv | default "8.4.12-fpm-bookworm"}}'
77+
TARGET: '{{ .t | default "ffmpeg" }}'
78+
cmds:
79+
- |
80+
docker build \
81+
--build-context php-base=docker-image://php:8.4.12-fpm-bookworm \
82+
--target {{.TARGET}} \
83+
-t toshy/trivy:{{.PHP_BASE}} .
84+
- |
85+
docker run \
86+
-v /var/run/docker.sock:/var/run/docker.sock \
87+
aquasec/trivy:{{.TRIVY_VERSION}} image \
88+
--ignore-unfixed --severity CRITICAL,HIGH --exit-code 1 \
89+
toshy/trivy:{{.PHP_BASE}}

0 commit comments

Comments
 (0)