fix(frontend): SERVER_API_URL 빌드 시점 주입 — next.config rewrites() 가 build-time 베이크
Build and Push Images / build-and-push (push) Has been cancelled
Build and Push Images / build-and-push (push) Has been cancelled
Next.js rewrites 는 빌드 시점에 평가되므로 SERVER_API_URL 미주입 시 fallback 127.0.0.1:8080 이 베이크되어 컨테이너에서 ECONNREFUSED. ARG SERVER_API_URL 로 받아 ENV 노출 → 빌드 시 http://pipeline-backend:8080 으로 베이크. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
# Pipeline Frontend — 엣지 배포용 프로덕션 이미지 (next build standalone)
|
||||
# next.config 의 output: "standalone" 산출물을 그대로 실행. node .next/standalone/server.js
|
||||
#
|
||||
# 주의: next.config 의 rewrites() 는 빌드 시점에 환경변수를 평가하므로
|
||||
# SERVER_API_URL 을 ARG 로 받아 ENV 로 노출한 뒤 빌드해야 한다.
|
||||
|
||||
FROM node:20-bookworm-slim AS builder
|
||||
|
||||
ARG SERVER_API_URL=http://pipeline-backend:8080
|
||||
ENV SERVER_API_URL=$SERVER_API_URL
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
@@ -10,7 +16,7 @@ RUN npm ci --prefer-offline --no-audit
|
||||
|
||||
COPY . .
|
||||
|
||||
# 프로덕션 빌드 (standalone)
|
||||
# 프로덕션 빌드 (standalone) — rewrites() 가 SERVER_API_URL 을 베이크
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
RUN npm run build
|
||||
|
||||
|
||||
Reference in New Issue
Block a user