-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (32 loc) · 781 Bytes
/
Dockerfile
File metadata and controls
48 lines (32 loc) · 781 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
48
FROM node:18.18.2-alpine as base
# ---------------
# Install Dependencies
# ---------------
FROM base as deps
WORKDIR /app
ENV DISABLE_OPENCOLLECTIVE=true
COPY package*.json ./
# Install app dependencies
RUN npm install
# ---------------
# Build App
# ---------------
FROM base as builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Build NestJS application
RUN npm run build
# Remove non production necessary modules
RUN npm prune --production
# ---------------
# Final App
# ---------------
FROM base as runner
ENV NODE_ENV=production
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/dist/ ./dist/
EXPOSE 3000
ENTRYPOINT ["npm", "run", "start:prod"]