feat(polaris)!: 改为 standalone 容器运行
Polaris CI / verify (push) Successful in 1m47s

将 Next.js 构建切换为 standalone,新增多阶段 Docker 镜像和非 root 运行。
CI 改为启动服务检查页面与静态资源,并移除静态导出校验。

BREAKING CHANGE: 不再生成 out/ 静态产物,部署需运行 Node 服务容器。
This commit is contained in:
2026-10-12 17:42:26 +08:00
parent 09e5735162
commit 2c674b7f2d
9 changed files with 126 additions and 61 deletions
+33 -3
View File
@@ -32,8 +32,38 @@ jobs:
- name: Test
run: corepack pnpm test
- name: Build static export
- name: Build standalone server
run: corepack pnpm build
- name: Verify static export
run: corepack pnpm verify:export
- name: Prepare standalone output
run: |
test -f .next/standalone/server.js
cp -r public .next/standalone/
cp -r .next/static .next/standalone/.next/
- name: Smoke test standalone server
shell: bash
run: |
set -euo pipefail
base_url="http://127.0.0.1:3100"
PORT=3100 HOSTNAME=127.0.0.1 node .next/standalone/server.js &
server_pid=$!
trap 'kill "$server_pid" 2>/dev/null || true' EXIT
ready=0
for _ in $(seq 1 30); do
if curl -fsS -o /dev/null "$base_url/"; then
ready=1
break
fi
kill -0 "$server_pid" 2>/dev/null || { echo "server process exited early" >&2; exit 1; }
sleep 1
done
test "$ready" -eq 1 || { echo "server not ready within 30s" >&2; exit 1; }
curl -fsS -o /dev/null "$base_url/categories/dev/"
curl -fsS -o /dev/null "$base_url/brand/logo.svg"
static_asset=$(curl -fsS "$base_url/" | grep -o '/_next/static/[^"]*' | sed -n '1p')
test -n "$static_asset" || { echo "homepage references no /_next/static asset" >&2; exit 1; }
curl -fsS -o /dev/null "$base_url$static_asset"