#!/bin/bash
# Stop and destroy all Docker containers for mtgonline project
echo "Stopping and destroying all containers..."
docker compose down -v --remove-orphans

# Build the backend container
echo "Building backend container..."
docker compose build backend

# Bring up the stack
echo "Bringing up the stack..."
docker compose up -d

# Wait for containers to start
echo "Waiting for containers to start..."
sleep 10

# Check container status
echo "Container status:"
docker compose ps

# Check logs for health
echo "Backend logs:"
docker compose logs backend --tail=20

# Check database logs
echo "Postgres logs:"
docker compose logs postgres postgres-mtgdata --tail=10
