#!/bin/bash # Quick Deploy Script fΓΌr lokale Entwicklung # Schnelles Deployment ohne umfangreiche Tests set -e # Configuration CONTAINER_NAME="portfolio-app" IMAGE_NAME="portfolio-app" PORT=3000 # Colors GREEN='\033[0;32m' BLUE='\033[0;34m' RED='\033[0;31m' NC='\033[0m' log() { echo -e "${BLUE}[$(date +'%H:%M:%S')]${NC} $1" } success() { echo -e "${GREEN}[SUCCESS]${NC} $1" } error() { echo -e "${RED}[ERROR]${NC} $1" } log "πŸš€ Quick deployment starting..." # Build Docker image log "πŸ—οΈ Building Docker image..." docker build -t "$IMAGE_NAME:latest" . # Stop existing container if [ "$(docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null)" = "true" ]; then log "πŸ›‘ Stopping existing container..." docker stop "$CONTAINER_NAME" docker rm "$CONTAINER_NAME" fi # Start new container log "πŸš€ Starting new container..." docker run -d \ --name "$CONTAINER_NAME" \ --restart unless-stopped \ -p "$PORT:3000" \ -e NODE_ENV=production \ "$IMAGE_NAME:latest" # Wait and check health log "⏳ Waiting for container to be ready..." sleep 5 if curl -f "http://localhost:$PORT/api/health" > /dev/null 2>&1; then success "βœ… Application is running at http://localhost:$PORT" else error "❌ Health check failed" docker logs "$CONTAINER_NAME" --tail=20 exit 1 fi