From e8f5a50b3e0aec4ff90cda6650d927c4b03f8906 Mon Sep 17 00:00:00 2001 From: Wonder Date: Thu, 9 Oct 2025 00:26:17 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E4=BF=AE=E6=AD=A3=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy.sh | 20 +++++++++++++++----- package.json | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/deploy.sh b/deploy.sh index 2f4042b..596dbca 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,7 +1,6 @@ #!/bin/bash # 自动部署脚本 -# 每天定时从 Gitea 拉取最新代码并执行构建 # 设置部署目录 DEPLOY_DIR="/root/online-slide" @@ -12,10 +11,21 @@ cd "$DEPLOY_DIR" || exit 1 # 拉取最新代码(仓库是公开的,无需认证) git pull origin main -# 安装依赖(如果需要) -npm install -# 执行构建 -npm run build +npm config set registry https://registry.npmmirror.com + +export PUPPETEER_SKIP_DOWNLOAD=1 + +# 安装依赖 +npm install --verbose + +# 启动服务 +# 安装PM2(如果尚未安装) +npm install -g pm2 + +# 使用PM2启动服务,确保只有一个实例运行 +pm2 start npm --name "online-slide" -- run web +# 保存PM2进程列表 +pm2 save echo "部署完成" diff --git a/package.json b/package.json index b1b32fc..be6dbfa 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "scripts": { "test": "gulp test", "start": "gulp serve", + "web": "gulp serve --host 0.0.0.0 --port 3000", "build": "gulp build" }, "repository": {