Files
portfolio/scripts/quick-deploy.sh
Dennis Konkol b9b3e5308d 🚀 Add automatic deployment system
- Add auto-deploy.sh script with full CI/CD pipeline
- Add quick-deploy.sh for fast development deployments
- Add Git post-receive hook for automatic deployment on push
- Add comprehensive deployment documentation
- Add npm scripts for easy deployment management
- Include health checks, logging, and cleanup
- Support for automatic rollback on failures
2025-09-05 19:47:53 +00:00

64 lines
1.3 KiB
Bash
Executable File

#!/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