feat: 初版
knowledge-base / deploy (push) Failing after 11s

This commit is contained in:
2026-06-23 19:09:11 +08:00
commit 73b9c9fb7a
61 changed files with 9549 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
#!/bin/sh
set -e
# 生成 nginx htpasswd
if [ -z "$NGINX_USER" ] || [ -z "$NGINX_PASSWORD" ]; then
echo "❌ 未设置 NGINX_USER 或 NGINX_PASSWORD,拒绝启动"
exit 1
fi
echo "🔐 生成访问密码..."
htpasswd -bc /etc/nginx/.htpasswd "$NGINX_USER" "$NGINX_PASSWORD"
# 后台启动 Next.js
echo "🚀 启动 Next.js..."
pnpm start &
# 等待 Next.js 就绪
echo "⏳ 等待 Next.js 就绪..."
MAX_WAIT=60
WAITED=0
while [ $WAITED -lt $MAX_WAIT ]; do
if wget -q --spider http://localhost:3000 2>/dev/null; then
echo "✅ Next.js 已就绪 (${WAITED}s)"
break
fi
sleep 1
WAITED=$((WAITED + 1))
done
# 前台启动 nginx
echo "🌐 启动 nginx..."
exec nginx -g 'daemon off;'