#!/usr/bin/env bash set -euo pipefail # Dev mode: run services with bind-mounted source code + auto-reload # Usage: # ./dev.sh # Start all services # ./dev.sh blog market # Start specific services (+ infra) # ./dev.sh --build blog # Rebuild image first, then start # ./dev.sh down # Stop everything # ./dev.sh logs blog # Tail logs for a service COMPOSE="docker compose -p rose-ash-dev -f docker-compose.yml -f docker-compose.dev.yml" INFRA_SERVICES="db pgbouncer redis redis-auth" case "${1:-up}" in down) $COMPOSE down ;; logs) shift $COMPOSE logs -f "$@" ;; build) shift if [[ $# -eq 0 ]]; then $COMPOSE build else $COMPOSE build "$@" fi ;; *) # Collect flags and service names BUILD_FLAG="" SERVICES=() for arg in "$@"; do if [[ "$arg" == "--build" ]]; then BUILD_FLAG="--build" else SERVICES+=("$arg") fi done if [[ ${#SERVICES[@]} -eq 0 ]]; then # Start everything $COMPOSE up $BUILD_FLAG else # Start infra + requested app services $COMPOSE up $BUILD_FLAG $INFRA_SERVICES "${SERVICES[@]}" fi ;; esac