helper scripts
This commit is contained in:
39
ctrl/run.sh
39
ctrl/run.sh
@@ -1,12 +1,16 @@
|
||||
#!/bin/bash
|
||||
# Run MPR stack locally
|
||||
# Usage: ./ctrl/run.sh [docker-compose args]
|
||||
# Usage: ./run.sh [OPTIONS] [docker-compose args]
|
||||
#
|
||||
# Options:
|
||||
# -f, --foreground Run in foreground (don't detach)
|
||||
# --build Rebuild images before starting
|
||||
#
|
||||
# Examples:
|
||||
# ./ctrl/run.sh # Start all services
|
||||
# ./ctrl/run.sh --build # Rebuild and start
|
||||
# ./ctrl/run.sh -d # Detached mode
|
||||
# ./ctrl/run.sh down # Stop all
|
||||
# ./run.sh # Start detached
|
||||
# ./run.sh -f # Start in foreground (see logs)
|
||||
# ./run.sh --build # Rebuild and start
|
||||
# ./run.sh logs -f # Follow logs
|
||||
|
||||
set -e
|
||||
|
||||
@@ -30,4 +34,27 @@ if ! grep -q "mpr.local.ar" /etc/hosts 2>/dev/null; then
|
||||
echo ""
|
||||
fi
|
||||
|
||||
docker compose "$@"
|
||||
# Parse options
|
||||
DETACH="-d"
|
||||
BUILD=""
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-f|--foreground)
|
||||
DETACH=""
|
||||
shift
|
||||
;;
|
||||
--build)
|
||||
BUILD="--build"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
# Pass remaining args to docker compose
|
||||
docker compose "$@"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Default: up with options
|
||||
docker compose up $DETACH $BUILD
|
||||
|
||||
Reference in New Issue
Block a user