diff --git a/scripts/deploy_docker.sh b/scripts/deploy_docker.sh index 3c998f9..e3b1cd1 100644 --- a/scripts/deploy_docker.sh +++ b/scripts/deploy_docker.sh @@ -24,7 +24,12 @@ fi if [ -z "$ENV_FILE" ]; then echo "未使用 env 文件,配置仅通过 server/config.$ENV_NAME.yaml 加载" >&2 fi -docker build -t "$IMAGE:$TAG" -f Dockerfile . +if docker image inspect "$IMAGE:$TAG" >/dev/null 2>&1; then + echo "使用已有镜像: $IMAGE:$TAG" +else + echo "镜像不存在,开始构建: $IMAGE:$TAG" + docker build -t "$IMAGE:$TAG" -f Dockerfile . +fi mkdir -p log storage/export CID_NAME="marketing-data-$ENV_NAME" RUNNING=$(docker inspect -f '{{.State.Running}}' "$CID_NAME" 2>/dev/null || echo false)