netbox-docker/build-all.sh

52 lines
1.1 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
# Builds all Docker images this project provides
2018-04-10 10:37:27 +02:00
# Arguments:
# BUILD: The release to build.
# Allowed: release, prerelease, branches, special
# Default: undefined
2018-04-10 10:58:31 +02:00
echo "▶️ $0 $*"
2018-04-10 10:37:27 +02:00
ALL_BUILDS=("release" "prerelease" "branches" "special")
BUILDS=("${BUILD:-"${ALL_BUILDS[@]}"}")
echo "⚙️ Configured builds: ${BUILDS[*]}"
2019-02-01 09:58:07 +01:00
if [ -n "${DEBUG}" ]; then
export DEBUG
fi
ERROR=0
for BUILD in "${BUILDS[@]}"; do
echo "🛠 Building '$BUILD' from '$DOCKERFILE'"
case $BUILD in
release)
# build the latest release
# shellcheck disable=SC2068
./build-latest.sh $@ || ERROR=1
;;
prerelease)
# build the latest pre-release
# shellcheck disable=SC2068
PRERELEASE=true ./build-latest.sh $@ || ERROR=1
;;
branches)
# build all branches
# shellcheck disable=SC2068
./build-branches.sh $@ || ERROR=1
;;
*)
echo "🚨 Unrecognized build '$BUILD'."
2019-02-01 09:58:07 +01:00
if [ -z "$DEBUG" ]; then
exit 1
2019-02-01 09:58:07 +01:00
else
echo "⚠️ Would exit here with code '1', but DEBUG is enabled."
fi
;;
esac
2019-02-01 09:58:07 +01:00
done
exit $ERROR