#!/bin/bash
set -e

echo "🚀 Starte Deployment für Projektverwaltung..."

cd ~/docker-setup/projektverwaltung

echo "📥 Pull latest changes for backend..."
cd backend
git pull origin main

echo "📥 Pull latest changes for frontend..."
cd ../frontend
git pull origin main

cd ..

echo "🛑 Stoppe alte Container..."
docker compose down

echo "📦 Baue Images neu..."
docker compose build

echo "⬆️ Starte Container..."
docker compose up -d

echo "🧹 Bereinige alte Images..."
docker image prune -f

echo "✅ Deployment abgeschlossen!"
docker compose ps

