File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Stage 1: Build the application
2
+ FROM node:18-alpine AS builder
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Copy package.json and package-lock.json
8
+ COPY package.json package-lock.json ./
9
+
10
+ # Install dependencies
11
+ RUN npm install
12
+
13
+ # Copy the rest of the application
14
+ COPY . .
15
+
16
+ # Build the application
17
+ RUN npm run build
18
+
19
+ # Stage 2: Create the production image
20
+ FROM node:18-alpine AS production
21
+
22
+ # Set working directory
23
+ WORKDIR /app
24
+
25
+ # Copy the built files from the builder stage
26
+ COPY --from=builder /app/dist /app/dist
27
+ COPY --from=builder /app/package.json /app/package-lock.json /app/
28
+
29
+ # Install production dependencies only
30
+ RUN npm ci --omit=dev
31
+
32
+ # Specify the default command
33
+ ENTRYPOINT ["node" , "dist/index.js" ]
You can’t perform that action at this time.
0 commit comments