-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·47 lines (34 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
executable file
·47 lines (34 loc) · 1.11 KB
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
# ====== BUILD STAGE ======
FROM node:24-slim AS builder
# Set working directory
WORKDIR /app
# Install system dependencies for build
RUN apt update && apt install -y openssl
# Copy package.json, package-lock.json & prisma folder
COPY package.json package-lock.json ./
COPY prisma.config.ts ./
COPY prisma ./prisma
# Install dependencies
RUN npm install
# Copy rest of the project files
COPY . .
# Build the app (NestJS -> dist/)
RUN npm run build
# ====== PRODUCTION STAGE ======
FROM node:24-slim AS production
# Set working directory
WORKDIR /app
# Install system dependencies needed at runtime
RUN apt update && apt install -y openssl curl
# Copy only necessary files from builder stage
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/package-lock.json ./package-lock.json
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/prisma.config.ts ./
COPY --from=builder /app/prisma ./prisma
# Install production dependencies
RUN npm install
# Set production env
ENV NODE_ENV=production
EXPOSE 5056
CMD ["npm", "run", "start:docker"]