mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-23 11:31:49 +01:00
update build all
Signed-off-by: Jess Frazelle <me@jessfraz.com>
This commit is contained in:
parent
697ff3e3c9
commit
652c7aa2b1
68
build-all.sh
68
build-all.sh
|
@ -1,25 +1,10 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# get the dockerfiles
|
||||
IFS=$'\n'
|
||||
files=( $(find . -iname '*Dockerfile' | sed 's|./||') )
|
||||
unset IFS
|
||||
|
||||
# build the changed dockerfiles
|
||||
for f in "${files[@]}"; do
|
||||
image=${f%Dockerfile}
|
||||
base=${image%%\/*}
|
||||
build_dir=$(dirname $f)
|
||||
suite=${build_dir##*\/}
|
||||
|
||||
if [[ -z "$suite" ]] || [[ "$suite" == "$base" ]]; then
|
||||
suite=latest
|
||||
fi
|
||||
|
||||
if [[ "${base}" == "sup" ]]; then
|
||||
continue
|
||||
fi
|
||||
build_and_push(){
|
||||
base=$1
|
||||
suite=$2
|
||||
build_dir=$3
|
||||
|
||||
(
|
||||
set -x
|
||||
|
@ -45,4 +30,47 @@ for f in "${files[@]}"; do
|
|||
docker tag r.j3ss.co/${base}:${suite} r.j3ss.co/${base}:latest
|
||||
docker push --disable-content-trust=false r.j3ss.co/${base}:latest
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
main(){
|
||||
# get the dockerfiles
|
||||
IFS=$'\n'
|
||||
files=( $(find . -iname '*Dockerfile' | sed 's|./||') )
|
||||
unset IFS
|
||||
|
||||
ERRORS=()
|
||||
# build all dockerfiles
|
||||
for f in "${files[@]}"; do
|
||||
image=${f%Dockerfile}
|
||||
base=${image%%\/*}
|
||||
build_dir=$(dirname $f)
|
||||
suite=${build_dir##*\/}
|
||||
|
||||
if [[ -z "$suite" ]] || [[ "$suite" == "$base" ]]; then
|
||||
suite=latest
|
||||
fi
|
||||
|
||||
if [[ "${base}" == "sup" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
{
|
||||
build_and_push "${base}" "${suite}" "${build_dir}"
|
||||
} || {
|
||||
# add to errors
|
||||
ERRORS+=("${base}:${suite}")
|
||||
}
|
||||
echo
|
||||
echo
|
||||
done
|
||||
|
||||
if [ ${#ERRORS[@]} -eq 0 ]; then
|
||||
echo "No errors, hooray"
|
||||
else
|
||||
echo "These images failed: ${ERRORS[@]}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
main $@
|
||||
|
|
Loading…
Reference in New Issue
Block a user