mirror of
https://github.com/netbox-community/netbox-docker.git
synced 2024-11-08 09:04:13 +01:00
d0ebb34432
This commit introduces a huge change in the build process. What changed: - Dockerfile.ldap was integrated into Dockerfile as a seperate [build stage][multistage-build]. - All the build scripts were refactored according to this. - The `docker-compose.yml` file was adjusted likewise. - The main build script, `/build.sh`, now always builds all targets (formerly called variants). - The minimal requirements for Docker and docker-compose have increased. - The build on hub.docker.com must be adjusted. This change should also fix #156 permanently. [multistage-build]: https://docs.docker.com/develop/develop-images/multistage-build/
55 lines
1.2 KiB
Bash
Executable File
55 lines
1.2 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
|
|
|
|
# Don't build if not on `master` and don't build if on a pull request,
|
|
# but build when DEBUG is not empty
|
|
|
|
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
|