File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ Thumbs.db
3636.github
3737.gitea
3838deploy
39+ ! deploy /docker /entrypoint.sh
3940
4041# Documentation
4142README.md
Original file line number Diff line number Diff line change @@ -46,3 +46,6 @@ next-env.d.ts
4646/public /assets /monaco-editor /*
4747/public /assets /prismjs /*
4848
49+ .claude
50+
51+ CLAUDE.md
Original file line number Diff line number Diff line change @@ -62,8 +62,12 @@ COPY --from=builder /app/.next/standalone ./
6262COPY --from=builder /app/.next/static ./.next/static
6363COPY --from=builder /app/public ./public
6464
65+ # 复制启动脚本
66+ COPY deploy/docker/entrypoint.sh ./entrypoint.sh
67+ RUN chmod +x ./entrypoint.sh
68+
6569# 暴露端口
6670EXPOSE 3000
6771
68- # 启动应用(standalone 模式使用 server.js )
69- CMD ["node" , "server.js " ]
72+ # 启动应用(包含预热 )
73+ CMD ["./entrypoint.sh " ]
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ set -e
3+
4+ # Start Next.js server in the background
5+ node server.js &
6+ SERVER_PID=$!
7+
8+ # Wait for the server to be ready
9+ echo " Waiting for Next.js server to start..."
10+ for i in $( seq 1 30) ; do
11+ if wget -q --spider http://localhost:3000/ 2> /dev/null; then
12+ echo " Server is up, starting warmup..."
13+ break
14+ fi
15+ if [ " $i " = " 30" ]; then
16+ echo " Server failed to start within 30s"
17+ exit 1
18+ fi
19+ sleep 1
20+ done
21+
22+ # Warmup key pages to trigger SSR compilation and caching
23+ echo " Warming up pages..."
24+ wget -q -O /dev/null http://localhost:3000/zh-CN 2> /dev/null || true
25+ wget -q -O /dev/null http://localhost:3000/zh-CN/search 2> /dev/null || true
26+ wget -q -O /dev/null http://localhost:3000/en 2> /dev/null || true
27+ echo " Warmup complete."
28+
29+ # Wait for the server process
30+ wait $SERVER_PID
Original file line number Diff line number Diff line change @@ -37,14 +37,25 @@ spec:
3737 - name : http
3838 containerPort : 3000
3939 protocol : TCP
40+ startupProbe :
41+ httpGet :
42+ path : /
43+ port : http
44+ initialDelaySeconds : 5
45+ periodSeconds : 5
46+ failureThreshold : 12
4047 livenessProbe :
4148 httpGet :
4249 path : /
4350 port : http
51+ periodSeconds : 30
52+ failureThreshold : 3
4453 readinessProbe :
4554 httpGet :
4655 path : /
4756 port : http
57+ periodSeconds : 10
58+ failureThreshold : 3
4859 resources :
4960 {{- toYaml .Values.resources | nindent 12 }}
5061 {{- with .Values.env }}
You can’t perform that action at this time.
0 commit comments