helper scripts

This commit is contained in:
2026-02-03 14:18:03 -03:00
parent 3db8c0c453
commit ffbbf87873
4 changed files with 69 additions and 9 deletions

View File

@@ -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