-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (24 loc) · 762 Bytes
/
Copy pathDockerfile
File metadata and controls
39 lines (24 loc) · 762 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
# --- Stage 1: Build ---
FROM node:20-alpine AS builder
WORKDIR /app
# Build tools needed to compile native modules (e.g. argon2) on musl/Alpine
RUN apk add --no-cache python3 make g++
COPY package*.json ./
RUN npm ci
COPY prisma ./prisma
RUN npx prisma generate
COPY . .
RUN npm run build
# --- Stage 2: Production runtime ---
FROM node:20-alpine AS production
WORKDIR /app
# Same build tools needed here too — this stage does its own separate npm ci
RUN apk add --no-cache python3 make g++
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY prisma ./prisma
COPY prisma.config.ts ./prisma.config.ts
EXPOSE 3000
CMD ["node", "dist/main.js"]