Refactor to multistage builds
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/
This commit is contained in:
parent
aca448d180
commit
65592f916f
11 changed files with 259 additions and 246 deletions
|
@ -3,6 +3,10 @@
|
|||
|
||||
echo "▶️ $0 $*"
|
||||
|
||||
###
|
||||
# Checking for the presence of GITHUB_OAUTH_CLIENT_ID
|
||||
# and GITHUB_OAUTH_CLIENT_SECRET
|
||||
###
|
||||
if [ -n "${GITHUB_OAUTH_CLIENT_ID}" ] && [ -n "${GITHUB_OAUTH_CLIENT_SECRET}" ]; then
|
||||
echo "🗝 Performing authenticated Github API calls."
|
||||
GITHUB_OAUTH_PARAMS="client_id=${GITHUB_OAUTH_CLIENT_ID}&client_secret=${GITHUB_OAUTH_CLIENT_SECRET}"
|
||||
|
@ -11,18 +15,33 @@ else
|
|||
GITHUB_OAUTH_PARAMS=""
|
||||
fi
|
||||
|
||||
###
|
||||
# Calling Github to get the all branches
|
||||
###
|
||||
ORIGINAL_GITHUB_REPO="${SRC_ORG-netbox-community}/${SRC_REPO-netbox}"
|
||||
GITHUB_REPO="${GITHUB_REPO-$ORIGINAL_GITHUB_REPO}"
|
||||
URL_RELEASES="https://api.github.com/repos/${GITHUB_REPO}/branches?${GITHUB_OAUTH_PARAMS}"
|
||||
|
||||
# Composing the JQ commans to extract the most recent version number
|
||||
JQ_BRANCHES='map(.name) | .[] | scan("^[^v].+") | match("^(master|develop).*") | .string'
|
||||
|
||||
CURL="curl -sS"
|
||||
|
||||
BRANCHES=$($CURL "${URL_RELEASES}" | jq -r 'map(.name) | .[] | scan("^[^v].+") | match("^(master|develop).*") | .string')
|
||||
# Querying the Github API to fetch all branches
|
||||
BRANCHES=$($CURL "${URL_RELEASES}" | jq -r "$JQ_BRANCHES")
|
||||
|
||||
###
|
||||
# Building each branch
|
||||
###
|
||||
|
||||
# keeping track whether an error occured
|
||||
ERROR=0
|
||||
|
||||
# calling build.sh for each branch
|
||||
for BRANCH in $BRANCHES; do
|
||||
# shellcheck disable=SC2068
|
||||
./build.sh "${BRANCH}" $@ || ERROR=1
|
||||
done
|
||||
|
||||
# returning whether an error occured
|
||||
exit $ERROR
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue