Enhance local-up script with CLI options for no-build and help

This commit is contained in:
Ross
2026-01-26 10:29:03 +00:00
parent d3d3638c1c
commit 0a1b21cec6
+31 -2
View File
@@ -2,7 +2,12 @@
set -e set -e
# Simple local bring-up helper. Usage: # Simple local bring-up helper. Usage:
# ./rad/scripts/local-up.sh # ./rad/scripts/local-up.sh [--no-build]
#
# Options:
# -n, --no-build Skip rebuilding images (omit `--build` when bringing up compose)
# -h, --help Show this help message
#
# It requires rad/.env.dev to exist (do NOT auto-create from examples) and then # It requires rad/.env.dev to exist (do NOT auto-create from examples) and then
# runs the prod+dev compose stack using COMPOSE_ENV to select the env file. # runs the prod+dev compose stack using COMPOSE_ENV to select the env file.
@@ -15,6 +20,26 @@ if [ ! -f .env.dev ]; then
exit 1 exit 1
fi fi
# Parse simple CLI flags. Use --no-build or -n to skip rebuilding docker images.
NO_BUILD=0
while [ "$#" -gt 0 ]; do
case "$1" in
-n|--no-build)
NO_BUILD=1
shift
;;
-h|--help)
sed -n '1,40p' "$0"
exit 0
;;
*)
echo "Unknown option: $1"
echo "Run with --help to see available options."
exit 1
;;
esac
done
# Default to 'dev' but allow overriding with COMPOSE_ENV environment variable # Default to 'dev' but allow overriding with COMPOSE_ENV environment variable
COMPOSE_ENV=${COMPOSE_ENV:-dev} COMPOSE_ENV=${COMPOSE_ENV:-dev}
@@ -98,4 +123,8 @@ else
fi fi
fi fi
COMPOSE_ENV=$COMPOSE_ENV docker compose -f docker/docker-compose.prod.yml -f docker/docker-compose.dev.yml up --build if [ "$NO_BUILD" -eq 1 ]; then
COMPOSE_ENV=$COMPOSE_ENV docker compose -f docker/docker-compose.prod.yml -f docker/docker-compose.dev.yml up
else
COMPOSE_ENV=$COMPOSE_ENV docker compose -f docker/docker-compose.prod.yml -f docker/docker-compose.dev.yml up --build
fi