Files
vexplor/docker/prod/frontend.Dockerfile
kjs c28e626dd5 Update Dockerfiles to increase Node.js memory limit
- Added `NODE_OPTIONS="--max-old-space-size=8192"` to both frontend Dockerfiles to allow Node.js to utilize more memory during the build process.
- This change aims to prevent memory-related issues during the application build.

(TASK:ERP-021)
2026-05-07 12:47:38 +09:00

65 lines
1.6 KiB
Docker

# Multi-stage build for Next.js
FROM dockerhub.wace.me/node:20.19-alpine.linux AS base
# curl 설치 (헬스체크용)
RUN apk add --no-cache curl
# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
# Install dependencies
COPY package.json package-lock.json* ./
RUN npm ci
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Disable telemetry during the build
ENV NEXT_TELEMETRY_DISABLED 1
# 빌드 시 환경변수 설정
ARG NEXT_PUBLIC_API_URL=https://api.vexplor.com
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
# Build the application
ENV DISABLE_ESLINT_PLUGIN=true
ENV NODE_OPTIONS="--max-old-space-size=8192"
RUN npm run build
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
# curl이 runner 스테이지에도 필요 (헬스체크용)
RUN apk add --no-cache curl
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Copy the Next.js build output
COPY --from=builder /app/public ./public
# Production 모드에서는 .next 폴더 전체를 복사
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
# node_modules 복사 (production dependencies)
COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./node_modules
USER nextjs
EXPOSE 3000
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
# Next.js start 명령어 사용
CMD ["npm", "start"]