zkt25/start-app.sh

21 lines
626 B
Bash
Executable File

#!/usr/bin/env bash
set -e
# 1) Clean up any existing containers (manual or compose)
for NAME in karel-simulator karel-redis; do
if docker ps -a --format '{{.Names}}' | grep -q "^${NAME}\$"; then
echo "🛑 Removing existing container '${NAME}'..."
docker rm -f "${NAME}" >/dev/null 2>&1 || true
fi
done
# 2) (Re)start both services in detached mode
echo "🚀 Starting multi-container application..."
docker compose up -d
# 3) Status
echo "✅ All containers are up:"
docker ps --filter "name=karel" --format " • {{.Names}} ({{.Image}}) → {{.Ports}}"
echo ""
echo "🌐 Simulator: http://localhost:8080/"