Sharathhebbar24 commited on
Commit
4089eed
·
verified ·
1 Parent(s): 8adcdca

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -25
Dockerfile CHANGED
@@ -1,25 +1,31 @@
1
- # Use an official Node.js runtime as a parent image
2
- FROM node:16 as builder
3
-
4
- # Set the working directory
5
- WORKDIR /app
6
-
7
- # Copy package.json and install dependencies
8
- COPY package.json .
9
- RUN npm install
10
-
11
- # Copy the rest of the application code
12
- COPY . .
13
-
14
- # Build the React app
15
- RUN npm run build
16
-
17
- # Use an Nginx image to serve the built app
18
- FROM nginx:alpine
19
- COPY --from=builder /app/build /usr/share/nginx/html
20
-
21
- # Expose the port Nginx runs on
22
- EXPOSE 80
23
-
24
- # Start Nginx
25
- CMD ["nginx", "-g", "daemon off;"]
 
 
 
 
 
 
 
1
+ # Use an official Node.js runtime as a parent image
2
+ FROM node:16 as builder
3
+
4
+ # Set the working directory
5
+ WORKDIR /app
6
+
7
+ # Copy package.json and install dependencies
8
+ COPY package*.json ./
9
+ RUN npm install
10
+
11
+ # Copy the rest of the application code
12
+ COPY . .
13
+
14
+ # Build the React app
15
+ RUN npm run build
16
+
17
+ # Use an Nginx image to serve the built app
18
+ FROM nginx:alpine
19
+
20
+ # Fix permissions for /var/cache/nginx
21
+ USER root
22
+ RUN mkdir -p /var/cache/nginx && chmod -R 777 /var/cache/nginx
23
+
24
+ # Copy built React files
25
+ COPY --from=builder /app/build /usr/share/nginx/html
26
+
27
+ # Expose port 80
28
+ EXPOSE 80
29
+
30
+ # Start Nginx
31
+ CMD ["nginx", "-g", "daemon off;"]