-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
39 lines (27 loc) · 922 Bytes
/
Dockerfile.dev
File metadata and controls
39 lines (27 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 운영환경(main branch)에서 사용하는 Dockerfile
# 1단계: build
FROM node:20-alpine AS builder
WORKDIR /app
COPY . .
# 빌드시점에 .env 파일 복사
COPY .env .env
RUN yarn install && yarn build --no-lint
# 2단계: production
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/yarn.lock ./yarn.lock
COPY --from=builder /app/next.config.ts ./next.config.ts
# 런타임시점에도 .env 파일 복사
COPY --from=builder /app/.env .env
# 빌드 시 Node 힙 메모리를 4GB까지 허용 (4096 = 4GB)
ENV NODE_OPTIONS="--max-old-space-size=4096"
# devDependencies는 설치하지 않고 dependencies만 설치
RUN yarn install --production
# 포트 설정 (dev 환경)
ENV PORT=14855
EXPOSE 14855
CMD ["yarn", "start"]