-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (33 loc) · 967 Bytes
/
Dockerfile
File metadata and controls
47 lines (33 loc) · 967 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
39
40
41
42
43
44
45
46
47
# ---------------------------------------------------
# STAGE 1: Build
# ---------------------------------------------------
FROM node:20-alpine AS builder
WORKDIR /app
# Install dependencies
COPY package*.json ./
RUN npm ci
# Copy source code
COPY . .
# Generate Clients for the build process
RUN npm run prisma:generate
# Build NestJS app
RUN npm run build
# ---------------------------------------------------
# STAGE 2: Production
# ---------------------------------------------------
FROM node:20-alpine AS production
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=4000
# Install all dependencies (including dev) so Prisma CLI is available for 'db pull'
COPY package*.json ./
RUN npm ci
# Copy built assets from builder
COPY --from=builder /app/dist ./dist
# Copy Prisma schema for introspection/generation
COPY --from=builder /app/prisma ./prisma
# Copy startup script
COPY start.sh ./start.sh
RUN chmod +x ./start.sh
EXPOSE 4000
CMD ["./start.sh"]