ci(docker): 添加平台配置以支持多架构构建

添加 PLATFORM 环境变量配置,允许在 docker-compose 和部署脚本中指定构建平台
This commit is contained in:
zhouyonggao 2025-11-28 16:14:25 +08:00
parent c62e98ae90
commit 3453570dc6
2 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,7 @@
services: services:
msdt: msdt:
build: . build: .
platform: ${PLATFORM:-linux/amd64}
container_name: msdt container_name: msdt
environment: environment:
- APP_ENV=${APP_ENV:-prod} - APP_ENV=${APP_ENV:-prod}

View File

@ -4,6 +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}
ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd) ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd)
@ -17,6 +18,7 @@ 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 \ docker run -d --name msdt \
--platform "$PLATFORM" \
-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,4 +43,3 @@ case "$CMD" in
echo "usage: deploy_image.sh <env> <image> [up|down|restart|logs]" >&2 echo "usage: deploy_image.sh <env> <image> [up|down|restart|logs]" >&2
exit 1 ;; exit 1 ;;
esac esac