forked from ZyntariHQ/Invoisio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (26 loc) · 711 Bytes
/
Copy pathDockerfile
File metadata and controls
36 lines (26 loc) · 711 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
# Build stage
FROM node:18-alpine AS builder
WORKDIR /app
# Install all dependencies (including dev) for building
COPY package*.json ./
RUN npm ci
# Copy source
COPY . .
# Generate Prisma client (no DB connection required)
RUN npx prisma generate
# Build NestJS to dist
RUN npm run build
# Production stage
FROM node:18-alpine AS production
WORKDIR /app
ENV NODE_ENV=production
# Copy only what we need
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/prisma ./prisma
# Remove dev dependencies to slim image
RUN npm prune --production
EXPOSE 3001
# Start compiled app
CMD ["node", "dist/main"]