From 231aba08b023dd9acd627e084e716d944bf1ea45 Mon Sep 17 00:00:00 2001 From: Joachim Friberg Date: Sun, 19 Apr 2026 22:23:57 +0200 Subject: [PATCH] Updated script --- scripts/build-and-push-image.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/build-and-push-image.sh b/scripts/build-and-push-image.sh index e6f88e1..e306c43 100755 --- a/scripts/build-and-push-image.sh +++ b/scripts/build-and-push-image.sh @@ -17,6 +17,7 @@ Options: --component Optional. Service name OR build context path under app. If omitted, build all services with build contexts. --repo Docker namespace/org (default: joafri) + --skip-non-buildable Exit 0 (with warning) when app has no services with build context --no-push Build only, no push or manifest creation -h, --help Show this help @@ -38,6 +39,7 @@ component="" tag="" repo_ns="$default_repo" push_image=1 +skip_non_buildable=0 while [[ $# -gt 0 ]]; do case "$1" in @@ -61,6 +63,10 @@ while [[ $# -gt 0 ]]; do push_image=0 shift ;; + --skip-non-buildable) + skip_non_buildable=1 + shift + ;; -h|--help) usage exit 0 @@ -162,6 +168,10 @@ cleanup() { } trap cleanup EXIT +if [[ -z "${AppID:-}" ]]; then + export AppID="$app_id" +fi + docker compose -f "$compose_file" config --format json > "$compose_json" mapfile -t all_services < <( @@ -169,7 +179,12 @@ mapfile -t all_services < <( ) if [[ ${#all_services[@]} -eq 0 ]]; then + if [[ "$skip_non_buildable" -eq 1 ]]; then + echo "WARN: no buildable services found in $compose_file (skipped)" + exit 0 + fi echo "ERROR: no buildable services found in $compose_file" >&2 + echo "Hint: pass --skip-non-buildable for batch loops over mixed app types." >&2 exit 1 fi