도커파일 Node.js용 생성기
Node.js 앱을 위한 프로덕션 준비 Dockerfile을 생성합니다. 모범 사례를 통해 Express, Next.js, NestJS 등을 지원합니다.
# Stage 1: Dependencies FROM node:20-alpine AS deps RUN apk add --no-cache libc6-compat WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci --only=production # Stage 2: Builder FROM node:20-alpine AS builder WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . RUN npm run build # Stage 3: Runner FROM node:20-alpine AS runner WORKDIR /app ENV NODE_ENV production RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nodeuser COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/dist ./dist COPY --from=builder /app/package.json ./ USER nodeuser EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget -qO- http://localhost:3000/health || exit 1 CMD ["npm", "start"]
node_modules npm-debug.log yarn-debug.log yarn-error.log .pnpm-debug.log .git .gitignore .env .env.local .env.development .env.production .env*.local *.log *.md .DS_Store .idea .vscode coverage .nyc_output dist build .next out .turbo Dockerfile .dockerignore docker-compose*.yml .github tests __tests__ *.test.js *.test.ts *.spec.js *.spec.ts