Sharathhebbar24 commited on
Commit
6801e8e
·
verified ·
1 Parent(s): 4089eed

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -4
Dockerfile CHANGED
@@ -5,7 +5,7 @@ FROM node:16 as builder
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
@@ -17,15 +17,18 @@ RUN npm run build
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;"]
 
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
 
17
  # Use an Nginx image to serve the built app
18
  FROM nginx:alpine
19
 
20
+ # Set user to root temporarily to fix permissions
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
+ # Change Nginx to listen on port 8080 instead of 80
28
+ RUN sed -i 's/listen\s\+80;/listen 8080;/' /etc/nginx/conf.d/default.conf
29
+
30
+ # Expose the new port
31
+ EXPOSE 8080
32
 
33
  # Start Nginx
34
  CMD ["nginx", "-g", "daemon off;"]