# RTGS 프론트 이미지 — 콘솔(index.html) + DT(dt.html) 정적 빌드 → nginx 서빙 + API 리버스프록시.
# ---------- build ----------
FROM node:22-bookworm-slim AS build
WORKDIR /app
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run build          # vite build → dist (index.html + dt.html 두 엔트리)

# ---------- runtime ----------
FROM nginx:1.27-alpine AS runtime
RUN apk add --no-cache curl
COPY --from=build /app/dist /usr/share/nginx/html
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
HEALTHCHECK --interval=10s --timeout=4s --retries=10 \
  CMD curl -fs http://localhost/ >/dev/null || exit 1
