forked from DigiNodes/truthbounty-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (25 loc) · 634 Bytes
/
Copy pathDockerfile
File metadata and controls
34 lines (25 loc) · 634 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
# Use Node LTS
FROM node:20-alpine AS builder
# Set working directory
WORKDIR /app
# Install dependencies
COPY package*.json ./
RUN npm install
# Copy project sources and generate Prisma client
COPY . .
RUN npx prisma generate
# Build app
RUN npm run build
# Keep only production dependencies
RUN npm prune --production
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY package*.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/src/generated ./src/generated
# Expose port
EXPOSE 3000
# Start app
CMD ["npm", "run", "start:prod"]