2017-06-13 08:30:07 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-09-13 21:21:11 +00:00
|
|
|
. $(dirname $0)/util
|
2017-06-13 08:30:07 +00:00
|
|
|
set -eu -o pipefail -x
|
|
|
|
|
2018-09-13 21:21:11 +00:00
|
|
|
lintLegacy() {
|
|
|
|
docker build -f ./hack/dockerfiles/lint.Dockerfile --force-rm .
|
|
|
|
}
|
|
|
|
|
|
|
|
lintDocker() {
|
|
|
|
export DOCKER_BUILDKIT=1
|
|
|
|
iidfile=$(mktemp -t docker-iidfile.XXXXXXXXXX)
|
|
|
|
docker build --iidfile $iidfile -f ./hack/dockerfiles/lint.buildkit.Dockerfile --force-rm .
|
|
|
|
iid=$(cat $iidfile)
|
|
|
|
docker rmi $iid
|
|
|
|
rm -f $iidfile
|
|
|
|
}
|
|
|
|
|
|
|
|
lint() {
|
|
|
|
buildctl build --frontend=dockerfile.v0 \
|
|
|
|
--local context=. --local dockerfile=. \
|
|
|
|
--frontend-opt filename=./hack/dockerfiles/lint.buildkit.Dockerfile
|
|
|
|
}
|
|
|
|
|
|
|
|
case $buildmode in
|
|
|
|
"buildkit")
|
|
|
|
lint
|
|
|
|
;;
|
|
|
|
"docker-buildkit")
|
|
|
|
lintDocker
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
lintLegacy
|
|
|
|
;;
|
|
|
|
esac
|