-
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (24 loc) · 669 Bytes
/
Dockerfile
File metadata and controls
34 lines (24 loc) · 669 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
# Stage 1: Build the application
FROM node:18 AS builder
# Set working directory
WORKDIR /
# Copy package.json and package-lock.json
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the application
RUN npm run build
# Stage 2: Run the application
FROM node:18-alpine
# Set working directory
WORKDIR /app
# Copy only the necessary files from the builder stage
COPY --from=builder /dist ./dist
COPY --from=builder /node_modules ./node_modules
COPY --from=builder /package*.json ./
# Expose the port the app runs on
EXPOSE 3000
# Command to run the application
CMD ["node", "dist/src/main.js"]