-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (26 loc) · 904 Bytes
/
Copy pathDockerfile
File metadata and controls
32 lines (26 loc) · 904 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
# --- Stage 1: Build ---
FROM node:18-alpine AS builder
RUN apk add --no-cache libc6-compat openssl
WORKDIR /app
COPY package*.json ./
COPY src/prisma ./src/prisma
RUN npm install
COPY . .
# Generate Prisma Client and build the app
RUN npx prisma generate --schema=./src/prisma/schema.prisma
RUN npx nx build api --configuration=production
# --- Stage 2: Runtime ---
FROM node:18-alpine
RUN apk add --no-cache libc6-compat openssl
WORKDIR /app
# Copy production build
COPY --from=builder /app/dist/api .
# Copy generated Prisma client from the builder stage
COPY --from=builder /app/node_modules/.prisma/client ./node_modules/.prisma/client
# Copy Prisma client definition
COPY --from=builder /app/node_modules/@prisma/client ./node_modules/@prisma/client
# Copy package files and install production dependencies
COPY package*.json ./
RUN npm install --omit=dev
EXPOSE 3000
CMD ["node", "main.js"]