All checks were successful
Build and Deploy LTY / build-and-deploy (push) Successful in 8m38s
- qy-lty-admin/Dockerfile: build 阶段加 ARG/ENV,让该变量在 next build 时进客户端 JS 包 - .gitea/workflows/deploy.yaml: admin docker build 加 --build-arg https://${DOMAIN_API}/api;删除已失效的 sed 替换 - k8s/admin-deployment-prod.yaml: 删除运行时无效的 NEXT_PUBLIC_API_BASE_URL env,留注释说明 根因:Next.js NEXT_PUBLIC_* 变量在 next build 时被静态编译进客户端 JS。 原配置在容器运行时才设该变量,对已打包的 fallback 默认值无效, 导致线上前端实际打到 http://localhost:8000/api 触发 ERR_CONNECTION_REFUSED。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
63 lines
1.4 KiB
YAML
63 lines
1.4 KiB
YAML
apiVersion: apps/v1
|
||
kind: Deployment
|
||
metadata:
|
||
name: lty-admin
|
||
labels:
|
||
app: lty-admin
|
||
spec:
|
||
replicas: 1
|
||
selector:
|
||
matchLabels:
|
||
app: lty-admin
|
||
template:
|
||
metadata:
|
||
labels:
|
||
app: lty-admin
|
||
spec:
|
||
containers:
|
||
- name: lty-admin
|
||
image: ${CI_REGISTRY_IMAGE}/lty-admin:latest
|
||
imagePullPolicy: Always
|
||
ports:
|
||
- containerPort: 3000
|
||
env:
|
||
- name: NODE_ENV
|
||
value: "production"
|
||
# NEXT_PUBLIC_API_BASE_URL 必须在 docker build 时通过 --build-arg 注入(Next.js 客户端打包),
|
||
# 运行时在此处设置无效。详见 .gitea/workflows/deploy.yaml 与 qy-lty-admin/Dockerfile。
|
||
livenessProbe:
|
||
httpGet:
|
||
path: /
|
||
port: 3000
|
||
initialDelaySeconds: 20
|
||
periodSeconds: 10
|
||
timeoutSeconds: 5
|
||
failureThreshold: 3
|
||
readinessProbe:
|
||
httpGet:
|
||
path: /
|
||
port: 3000
|
||
initialDelaySeconds: 10
|
||
periodSeconds: 5
|
||
timeoutSeconds: 3
|
||
failureThreshold: 3
|
||
resources:
|
||
requests:
|
||
memory: "128Mi"
|
||
cpu: "100m"
|
||
limits:
|
||
memory: "512Mi"
|
||
cpu: "500m"
|
||
---
|
||
apiVersion: v1
|
||
kind: Service
|
||
metadata:
|
||
name: lty-admin
|
||
spec:
|
||
selector:
|
||
app: lty-admin
|
||
ports:
|
||
- protocol: TCP
|
||
port: 3000
|
||
targetPort: 3000
|