#!/usr/bin/env bash
# 多架构镜像发布(amd64 + arm64)。用法:
#   ./scripts/publish-images.sh <image-registry>/ai-gateway:0.11.0
# 前置:已启用 docker buildx(docker buildx create --use)。
set -euo pipefail

TAG="${1:?用法: publish-images.sh <registry>/<repo>:<tag>}"
cd "$(dirname "$0")/.."

echo "==> 构建并推送多架构镜像: ${TAG}"
docker buildx build \
  --platform linux/amd64,linux/arm64 \
  --build-arg VERSION="${TAG##*:}" \
  -t "${TAG}" \
  --push \
  -f deploy/Dockerfile .

echo "==> 完成: ${TAG} (amd64 + arm64)"
