#!/bin/bash set -e echo "๐Ÿš€ Starting optimized deployment..." # Pull latest changes echo "๐Ÿ“ฅ Pulling latest changes from git..." git pull # Build new image in background (doesn't stop running container) echo "๐Ÿ”จ Building new Docker image (this runs while app is still online)..." docker compose build # Quick restart with pre-built image echo "๐Ÿ”„ Restarting with new image (minimal downtime)..." docker compose up -d # Clean up old images echo "๐Ÿงน Cleaning up old images..." docker image prune -f echo "โœ… Deployment complete!" echo "" echo "๐Ÿ“Š Showing logs (Ctrl+C to exit)..." docker compose logs -f