#!/bin/bash
# ============================================
# BraceIQMed - Deployment Script
# Run this on the EC2 server to deploy/update
# ============================================

set -e

echo "============================================"
echo "BraceIQMed Deployment"
echo "============================================"

# Change to repo directory
cd ~/braceiqmed

# Pull latest changes
echo "Pulling latest changes..."
git pull origin main

# Build and restart containers
echo "Building and restarting containers..."
docker compose build
docker compose up -d

# Show status
echo "============================================"
echo "Deployment complete!"
echo "============================================"
docker compose ps

# Show recent logs
echo ""
echo "Recent logs:"
docker compose logs --tail=20
