#!/usr/bin/env bash
set -euo pipefail

# Load .env if present
if [ -f .env ]; then
  echo "Loading .env..."
  set -a; source .env; set +a
fi

echo "Building and starting NOFX stack..."
docker compose --env-file .env build

echo "Starting services..."
docker compose --env-file .env up -d

echo "Showing service status..."
docker compose ps

echo "Tail logs (Ctrl-C to exit)"
docker compose logs -f --tail=200