-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (20 loc) · 853 Bytes
/
Copy pathDockerfile
File metadata and controls
26 lines (20 loc) · 853 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
# ── Stage 1: Install all deps + build TypeScript ─────────────────────────────
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY prisma ./prisma
RUN npm run db:generate
COPY . .
RUN npm run build
# ── Stage 2: Production-only image ────────────────────────────────────────────
FROM node:20-alpine AS runner
WORKDIR /app
# The app runs Prisma schema sync on startup, so the runtime image needs the
# Prisma CLI available without downloading it via npx at container boot.
COPY package*.json ./
RUN npm ci
# Copy built output + Prisma schema from builder
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/prisma ./prisma
CMD ["node", "dist/index.js"]