fix(deploy_image): 移除默认平台设置并改进平台参数处理

修改部署脚本以支持动态平台参数,移除默认的linux/amd64设置
在帮助信息中添加平台参数说明
This commit is contained in:
zhouyonggao 2025-11-28 16:24:40 +08:00
parent 3453570dc6
commit 85e86abbce
1 changed files with 5 additions and 3 deletions

View File

@ -4,7 +4,7 @@ set -euo pipefail
ENV=${1:-test} ENV=${1:-test}
IMAGE=${2:-marketingsystemdatatool_msdt:latest} IMAGE=${2:-marketingsystemdatatool_msdt:latest}
CMD=${3:-up} CMD=${3:-up}
PLATFORM=${PLATFORM:-linux/amd64} PLATFORM=${PLATFORM:-}
ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd) ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd)
@ -17,8 +17,9 @@ fi
case "$CMD" in case "$CMD" in
up) up)
docker rm -f msdt >/dev/null 2>&1 || true docker rm -f msdt >/dev/null 2>&1 || true
docker run -d --name msdt \ PLATFORM_FLAG=""
--platform "$PLATFORM" \ if [ -n "$PLATFORM" ]; then PLATFORM_FLAG="--platform $PLATFORM"; fi
docker run -d --name msdt $PLATFORM_FLAG \
-p 8077:8077 \ -p 8077:8077 \
-e APP_ENV="$ENV" \ -e APP_ENV="$ENV" \
-e MARKETING_DB_HOST="${MARKETING_DB_HOST:-}" \ -e MARKETING_DB_HOST="${MARKETING_DB_HOST:-}" \
@ -41,5 +42,6 @@ case "$CMD" in
docker logs -f msdt ;; docker logs -f msdt ;;
*) *)
echo "usage: deploy_image.sh <env> <image> [up|down|restart|logs]" >&2 echo "usage: deploy_image.sh <env> <image> [up|down|restart|logs]" >&2
echo "env overrides: set PLATFORM=linux/amd64 or PLATFORM=linux/arm64 if needed" >&2
exit 1 ;; exit 1 ;;
esac esac