File size: 605 Bytes
ecacdf7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Build stage
FROM node:20-slim AS builder

# Set working directory
WORKDIR /app

# Copy package files
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy source code
COPY . .

# Build the application
RUN npm run build

# Production stage
FROM node:20-slim

WORKDIR /app

# Install serve to run the built application
RUN npm install -g serve

# Copy only the built files from builder stage
COPY --from=builder /app/dist ./dist
# Remove unnecessary files
RUN rm -rf src node_modules

# Expose port 7860 and serve the built application
EXPOSE 7860
CMD ["serve", "-s", "dist", "-p", "7860"]