haumdaucher_de/deploy.sh

33 lines
930 B
Bash
Executable File

#!/bin/bash
# Configuration
NAMESPACE="haumdaucher"
REGISTRY="registry.haumdaucher.de"
IMAGE_BASE_NAME="haumdaucher-website"
IMAGE_NAME="$REGISTRY/$IMAGE_BASE_NAME"
TAG="latest"
echo "🚀 Starting deployment for Haumdaucher..."
# Create namespace if it doesn't exist
kubectl create namespace $NAMESPACE --dry-run=client -o yaml | kubectl apply -f -
# Build the docker image
echo "📦 Building Docker image..."
docker build -t $IMAGE_NAME:$TAG .
# Push the docker image
echo "📤 Pushing Docker image to $REGISTRY..."
docker push $IMAGE_NAME:$TAG
# Apply manifests
echo "🎡 Applying Kubernetes manifests..."
kubectl apply -f k8s-manifests.yaml
# Force rollout restart to pick up the new 'latest' image
echo "🔄 Restarting deployment to pull latest image..."
kubectl rollout restart deployment/haumdaucher-website -n $NAMESPACE
echo "✅ Deployment complete!"
echo "Check status with: kubectl get pods -n $NAMESPACE"