mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2024-11-22 16:03:10 +01:00
20109c3392
This changes the build process even further. Instead f using `wget` to fetch the current code, `git` is used. This allows for faster switching between branches, because only the differences between them have to be fetched from the server. But the main advantage is that the build cache can finally be used as designed by Docker. Repetitive builds are very fast now. This is also true between branches and tags, as long as the `requirements.txt` file doesn't change.
52 lines
1.1 KiB
Bash
Executable File
52 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Builds all Docker images this project provides
|
|
# Arguments:
|
|
# BUILD: The release to build.
|
|
# Allowed: release, prerelease, branches, special
|
|
# Default: undefined
|
|
|
|
echo "▶️ $0 $*"
|
|
|
|
ALL_BUILDS=("release" "prerelease" "branches" "special")
|
|
BUILDS=("${BUILD:-"${ALL_BUILDS[@]}"}")
|
|
|
|
echo "⚙️ Configured builds: ${BUILDS[*]}"
|
|
|
|
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'."
|
|
|
|
if [ -z "$DEBUG" ]; then
|
|
exit 1
|
|
else
|
|
echo "⚠️ Would exit here with code '1', but DEBUG is enabled."
|
|
fi
|
|
;;
|
|
esac
|
|
done
|
|
|
|
exit $ERROR
|