diff --git a/build.sh b/build.sh index 780d6d3..0709f1f 100755 --- a/build.sh +++ b/build.sh @@ -8,14 +8,20 @@ function build_image() { docker build -t "$image_name:latest" -f "$dockerfile" . } -# iterate through the docker files in format Dockerfile.IMAGE_NAME -for dockerfile in Dockerfile.* -do +pids=() +for dockerfile in Dockerfile.*; do ( build_image "$dockerfile" ) & + pids+=($!) done -wait - +fail=0 +for pid in "${pids[@]}"; do + wait "$pid" || fail=1 +done +if (( fail )); then + echo "One or more builds failed." + exit 1 +fi