From daa920116b9a917b26be2fe6b8e437bfa2fe3f0b Mon Sep 17 00:00:00 2001 From: zhouyonggao <1971162852@qq.com> Date: Fri, 28 Nov 2025 16:05:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=83=A8=E7=BD=B2):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E8=84=9A=E6=9C=AC=E7=94=A8=E4=BA=8E=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=92=8C=E7=AE=A1=E7=90=86=E5=AE=B9=E5=99=A8=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/deploy_image.sh | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 scripts/deploy_image.sh diff --git a/scripts/deploy_image.sh b/scripts/deploy_image.sh new file mode 100644 index 0000000..e3b46ee --- /dev/null +++ b/scripts/deploy_image.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -euo pipefail + +ENV=${1:-test} +IMAGE=${2:-marketingsystemdatatool_msdt:latest} +CMD=${3:-up} + +ROOT_DIR=$(cd "$(dirname "$0")/.." && pwd) + +if [ -f "$ROOT_DIR/.env.$ENV" ]; then + set -a + . "$ROOT_DIR/.env.$ENV" + set +a +fi + +case "$CMD" in + up) + docker rm -f msdt >/dev/null 2>&1 || true + docker run -d --name msdt \ + -p 8077:8077 \ + -e APP_ENV="$ENV" \ + -e MARKETING_DB_HOST="${MARKETING_DB_HOST:-}" \ + -e MARKETING_DB_PORT="${MARKETING_DB_PORT:-}" \ + -e MARKETING_DB_USER="${MARKETING_DB_USER:-}" \ + -e MARKETING_DB_PASSWORD="${MARKETING_DB_PASSWORD:-}" \ + -e MARKETING_DB_NAME="${MARKETING_DB_NAME:-}" \ + -e YMT_DB_HOST="${YMT_DB_HOST:-}" \ + -e YMT_DB_PORT="${YMT_DB_PORT:-}" \ + -e YMT_DB_USER="${YMT_DB_USER:-}" \ + -e YMT_DB_PASSWORD="${YMT_DB_PASSWORD:-}" \ + -e YMT_DB_NAME="${YMT_DB_NAME:-}" \ + -v "$ROOT_DIR/server/storage:/app/storage" \ + "$IMAGE" ;; + down) + docker rm -f msdt >/dev/null 2>&1 || true ;; + restart) + docker restart msdt ;; + logs) + docker logs -f msdt ;; + *) + echo "usage: deploy_image.sh [up|down|restart|logs]" >&2 + exit 1 ;; +esac +