-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (21 loc) · 703 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (21 loc) · 703 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
# Dockerfile
# Step 1: Use Node.js base image
FROM node:18 AS build
# Step 2: Set working directory
WORKDIR /app
# Step 3: Copy package.json and package-lock.json
COPY package*.json ./
# Step 4: Install dependencies with legacy peer dependencies option
RUN npm install --legacy-peer-deps
# Step 5: Copy the rest of the application code
COPY . .
# Step 6: Build the application
RUN npm run build
# Step 7: Use a lightweight web server for the production build
FROM nginx:alpine AS production
# Step 8: Copy built files from the previous stage
COPY --from=build /app/dist /usr/share/nginx/html
# Expose port 80 to access the app
EXPOSE 80
# Start Nginx server
CMD ["nginx", "-g", "daemon off;"]