diff --git a/scripts/local-up.sh b/scripts/local-up.sh index c74d0d2b..987ce697 100755 --- a/scripts/local-up.sh +++ b/scripts/local-up.sh @@ -2,7 +2,12 @@ set -e # 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 # 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 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 COMPOSE_ENV=${COMPOSE_ENV:-dev} @@ -98,4 +123,8 @@ else 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