File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # Install dependencies and build app
2- FROM node:20-alpine AS builder
3-
1+ FROM node:20-alpine AS deps
42WORKDIR /app
53
6- ENV NODE_ENV=production
7-
8- # pnpm 설치
9- RUN corepack enable && corepack prepare pnpm@8.15.4 --activate
4+ RUN corepack enable
105
11- # 의존성 관련 파일 복사 및 설치
12- COPY pnpm-lock.yaml package.json ./
6+ COPY package.json pnpm-lock.yaml ./
137
148RUN pnpm install --frozen-lockfile
159
16- # 소스 코드 복사 및 빌드
10+ FROM node:20-alpine AS builder
11+ WORKDIR /app
12+
13+ RUN corepack enable
14+ ENV NODE_ENV=production
15+ ENV NEXT_TELEMETRY_DISABLED=1
16+
17+ COPY --from=deps /app/node_modules ./node_modules
1718COPY . .
19+
1820RUN pnpm build
1921
20- # 런타임 컨테이너 설정
2122FROM node:20-alpine AS runner
22-
2323WORKDIR /app
2424
2525ENV NODE_ENV=production
26+ ENV NEXT_TELEMETRY_DISABLED=1
27+ ENV PORT=3000
2628
27- RUN corepack enable && corepack prepare pnpm@8.15.4 --activate
28-
29- # package.json 필요 시 복사
30- COPY --from=builder /app/package.json ./
29+ RUN addgroup -S nodejs && adduser -S nextjs -G nodejs
3130
32- # Next.js standalone 모드로 복사
3331COPY --from=builder /app/.next/standalone ./
3432COPY --from=builder /app/.next/static ./.next/static
3533COPY --from=builder /app/public ./public
3634
35+ USER nextjs
3736EXPOSE 3000
3837
3938CMD ["node" , "server.js" ]
Original file line number Diff line number Diff line change 11import type { NextConfig } from "next" ;
22
33const nextConfig : NextConfig = {
4- /* config options here */
4+ reactStrictMode : false ,
5+ output : "standalone" ,
56} ;
67
78export default nextConfig ;
Original file line number Diff line number Diff line change 88 "start" : " next start" ,
99 "lint" : " eslint" ,
1010 "format" : " prettier --write ." ,
11- "format:check" : " prettier --check ."
11+ "format:check" : " prettier --check ." ,
12+ "docker:build" : " docker build -t undefined-dev ." ,
13+ "docker:run" : " docker run -p 3000:3000 undefined-dev"
1214 },
1315 "dependencies" : {
1416 "class-variance-authority" : " ^0.7.1" ,
You can’t perform that action at this time.
0 commit comments