vitallink-BS/vitallink/nuke-docker.sh

41 lines
1.2 KiB
Bash
Executable File

#!/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"}'