change build.sh better comments

This commit is contained in:
2026-04-28 13:57:43 +02:00
parent 3047e89326
commit fa3dbe180a

View File

@@ -25,17 +25,17 @@
# -o pipefail: Make pipelines fail if any command in the pipe fails, not just the last one # -o pipefail: Make pipelines fail if any command in the pipe fails, not just the last one
set -euo pipefail set -euo pipefail
# --- services to build (subfolder name = image suffix) ---------------------
#SERVICES=(backend frontend)
#cd to script dir #cd to script dir
pushd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null pushd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null
SCRIPT_DIR="$(pwd)" SCRIPT_DIR="$(pwd)"
source "${SCRIPT_DIR}/.env" source "${SCRIPT_DIR}/.env"
# read from .env:
# REGISTRY, IMAGE_NAME, IMAGE_VERSION, SNAPSHOT_TAG
# SERVICES (subfolder name = image suffix)
popd > /dev/null popd > /dev/null
#default: snapshot #default: build snapshot
VERSION="${IMAGE_TAG}-${SNAPSHOT_TAG}" VERSION="${IMAGE_VERSION}-${SNAPSHOT_TAG}" # read from .env
PUSH=false PUSH=false
ONLY=() ONLY=()
@@ -64,7 +64,7 @@ if [[ ${#ONLY[@]} -gt 0 ]]; then
fi fi
echo "============================================" echo "============================================"
echo " ${IMAGE_NAME} - Docker Build" echo " Docker Build - ${IMAGE_NAME}"
echo "" echo ""
echo " Services : ${SERVICES[*]}" echo " Services : ${SERVICES[*]}"
echo " Version : ${VERSION}" echo " Version : ${VERSION}"
@@ -83,7 +83,7 @@ done
# --- push ------------------------------------------------------------------- # --- push -------------------------------------------------------------------
if $PUSH; then if $PUSH; then
docker login "${REGISTRY}" docker login "${REGISTRY}" # read from .env
for SERVICE in "${SERVICES[@]}"; do for SERVICE in "${SERVICES[@]}"; do
IMAGE="${REGISTRY}/${IMAGE_NAME}-${SERVICE}:${VERSION}" IMAGE="${REGISTRY}/${IMAGE_NAME}-${SERVICE}:${VERSION}"
echo "" echo ""