#!/bin/bash echo "๐Ÿ”„ INITIATING REBUILD (PRESERVING DATABASE)..." # 1. Stop containers # Removed '--volumes' flag so named volumes aren't wiped inadvertently echo "๐Ÿ›‘ Stopping containers..." docker compose down --remove-orphans # 2. DATABASE PRESERVATION # This section is now disabled to keep your data safe. # if [ -f "vitallink.db" ]; then # echo "๐Ÿ—‘๏ธ Deleting database file (vitallink.db)..." # rm vitallink.db # fi echo "๐Ÿ’พ Database file (vitallink.db) preserved." # Optional: Still good to check for that directory error if [ -d "wristband_config.yaml" ]; then echo "๐Ÿ—‘๏ธ Removing broken config directory..." rm -rf wristband_config.yaml fi # 3. Prune Docker System # Removes stopped containers and unused networks to save space echo "๐Ÿงน Pruning Docker system..." docker system prune -f # 4. Rebuild everything from scratch # This ensures code changes (Python/React) are applied echo "๐Ÿ—๏ธ Rebuilding images (No Cache)..." docker compose build --no-cache # 5. Start it up echo "๐Ÿš€ Launching VitalLink..." docker compose up -d echo "โœ… DONE! System rebuilt, Database preserved. Access at:" # Print the IP for convenience hostname -I | awk '{print "http://" $1 ":5173"}'