#!/usr/bin/env bash
# scripts/docker-restart.sh — rebuild + restart docker container.
# Usage: ./scripts/docker-restart.sh
set -euo pipefail
cd "$(dirname "$0")/.."

echo "=== stopping existing container ==="
docker compose -f docker/docker-compose.yml down 2>/dev/null || true

echo "=== rebuilding image ==="
docker compose -f docker/docker-compose.yml build

echo "=== starting container ==="
docker compose -f docker/docker-compose.yml up -d

echo "=== status ==="
docker compose -f docker/docker-compose.yml ps

echo ""
echo "app: http://localhost:${PORT:-8080}"
echo "logs: docker compose -f docker/docker-compose.yml logs -f"
