fix(admin-web): Dockerfile 构建时传入 SNAPSHOT_SERVICE_URL build arg

Next.js rewrites 在构建阶段烘焙,运行时环境变量不生效

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-24 02:53:03 -08:00
parent de361e24f6
commit ff28615fc3
2 changed files with 3 additions and 1 deletions

View File

@ -22,7 +22,7 @@ ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production ENV NODE_ENV=production
# Next.js rewrite 在 build 时计算, 需要通过 ARG 传入后端服务地址 # Next.js rewrite 在 build 时计算, 需要通过 ARG 传入后端服务地址
ARG SNAPSHOT_SERVICE_URL=http://snapshot-service:3099 ARG SNAPSHOT_SERVICE_URL=https://rwaapi.szaiai.com/snapshot-api
ENV SNAPSHOT_SERVICE_URL=$SNAPSHOT_SERVICE_URL ENV SNAPSHOT_SERVICE_URL=$SNAPSHOT_SERVICE_URL
# 构建应用 # 构建应用

View File

@ -3,6 +3,8 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
args:
SNAPSHOT_SERVICE_URL: https://rwaapi.szaiai.com/snapshot-api
image: rwadurian-admin-web:latest image: rwadurian-admin-web:latest
container_name: rwadurian-admin-web container_name: rwadurian-admin-web
restart: unless-stopped restart: unless-stopped