Skip to content

Commit

Permalink
feat: add run.sh script that runs hadolint on Dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
VladCroitoru committed Nov 18, 2021
1 parent f9114f0 commit 40b2f2e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

function runHadolint() {
local pwd="$(pwd)/$1"
local dockerfiles=$(find "$pwd" -type f -name Dockerfile)
local count=$(echo "$dockerfiles" | wc -l)
echo "running hadoling in $pwd"
echo "dockerfiles count: $count"
echo ""
for dockerfile in $dockerfiles; do
echo "hadolint $dockerfile"
hadolint "$dockerfile" --format json > "$dockerfile.hadolint.json"
done
}

function main() {
if [ -n "$1" ];
then
runHadolint "$1"
else
echo 'no target folder provided'
fi
}

main "$@"

0 comments on commit 40b2f2e

Please sign in to comment.