-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (34 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
47 lines (34 loc) · 1.28 KB
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
40
41
42
43
44
45
46
47
# syntax=docker/dockerfile:1
FROM node:20.20.0-bookworm-slim AS deps
WORKDIR /app
# Prisma가 openssl 필요할 수 있어서 설치(경고/런타임 문제 방지)
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends openssl \
&& rm -rf /var/lib/apt/lists/*
COPY package*.json ./
# ✅ 핵심: deps 단계에서 postinstall 같은 스크립트 실행 차단
RUN npm ci --ignore-scripts
FROM node:20.20.0-bookworm-slim AS build
WORKDIR /app
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends openssl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# ✅ 여기서는 prisma 폴더가 존재하므로 generate를 정상 수행(|| true 제거)
RUN npx prisma generate
RUN npm run build
FROM node:20.20.0-bookworm-slim AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends openssl \
&& rm -rf /var/lib/apt/lists/*
# 런타임은 빌드 결과물 + node_modules만 가져오면 됨
COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/prisma ./prisma
COPY --from=build /app/package*.json ./
COPY --from=build /app/prisma.config.ts ./prisma.config.ts
EXPOSE 3000
CMD ["node", "dist/src/main.js"]