lab 7 done

This commit is contained in:
Khakimov Dmitrij
2026-11-29 21:59:16 +03:00
parent 20afc2c790
commit 2a7418fc45
170 changed files with 10332 additions and 96 deletions
+23
View File
@@ -0,0 +1,23 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
work="$PWD/.runtime/scans"
mkdir -p "$work/manifests" "$work/cache"
cp go.mod go.sum "$work/manifests/"
scanner() {
docker run --rm --cpus 0.75 --memory 512m \
-v "$work:/scan" aquasec/trivy:0.67.2 --cache-dir /scan/cache \
"$@"
}
scanner fs --scanners vuln --format json --output /scan/manifests.json /scan/manifests
if [ "$#" -eq 0 ]; then
# Only images in this project. No Docker socket is mounted into Trivy.
set -- $(./scripts/compose.sh --profile operator config --images | sort -u)
fi
for image do
name=$(printf '%s' "$image" | cut -d@ -f1 | tr '/:' '__')
printf 'Scanning %s\n' "$image"
scan_path="$work/image.tar"
docker image save -o "$scan_path" "$image"
scanner image --scanners vuln,secret --format json --output "/scan/$name.json" --input /scan/image.tar
done