Skip to content

Commit

Permalink
ingress-controller/ci: check docker base images
Browse files Browse the repository at this point in the history
  • Loading branch information
calebdoxsey committed Jan 11, 2024
1 parent b108dba commit 24c1535
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions scripts/check-docker-images
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/bash
set -euo pipefail

_project_root="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/.."
for _f in $(find "$_project_root" -name "*Dockerfile*"); do
echo "checking $_f"
for _img in $(sed -n -r -e 's/^FROM ([^:]*)(:[^@]*)(@sha256[^ ]*).*$/\1\2\3/p' "$_f"); do
echo "- $_img"
_media_type="$(
docker buildx imagetools inspect \
--format='{{print .Manifest.MediaType }}' \
"$_img"
)"

if [[ "$_media_type" != "application/vnd.oci.image.index.v1+json" && "$_media_type" != "application/vnd.docker.distribution.manifest.list.v2+json" ]]; then
echo "not a multi-platform manifest"
exit 1
fi
done
done

0 comments on commit 24c1535

Please sign in to comment.