-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add run.sh script that runs hadolint on Dockerfiles
- Loading branch information
1 parent
f9114f0
commit 40b2f2e
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "$@" |