#!/usr/bin/env bash
# 用途：部署 {{APP_NAME}} 到 K3s

set -euo pipefail

BASE_DIR="$(cd "$(dirname "$0")" && pwd)"
MANIFESTS="$BASE_DIR/manifests"
APP_NAME="{{APP_NAME}}"

echo "🚀 部署 $APP_NAME..."

# 依序套用 manifests（按檔名排序）
kubectl apply -f "$MANIFESTS/"

echo "⏳ 等待 Pod 就緒..."
kubectl rollout status deployment/$APP_NAME --timeout=120s

echo "✅ $APP_NAME 部署完成"
