Add Docker deployment as the recommended production setup.
Include Dockerfile, docker-compose on port 3130, npm mirror config, deploy scripts, and DOCKER.md; keep PM2 docs as fallback. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+9
-1
@@ -16,13 +16,21 @@ git pull origin main
|
||||
echo "==> 安装依赖..."
|
||||
npm ci || npm install
|
||||
|
||||
echo "==> 停止 PM2(避免无构建产物时反复重启)..."
|
||||
pm2 stop "$APP_NAME" 2>/dev/null || true
|
||||
|
||||
echo "==> 生产构建..."
|
||||
npm run build
|
||||
|
||||
if [[ ! -f .next/BUILD_ID ]]; then
|
||||
echo "ERROR: 构建失败,未找到 .next/BUILD_ID,请先解决 npm run build 报错后再启动。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "==> 确保日志目录存在..."
|
||||
mkdir -p logs
|
||||
|
||||
echo "==> 重启 PM2..."
|
||||
echo "==> 启动 PM2..."
|
||||
if pm2 describe "$APP_NAME" > /dev/null 2>&1; then
|
||||
pm2 restart "$APP_NAME"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user