gaialive commited on
Commit
b5d093d
·
verified ·
1 Parent(s): 7754a75

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +33 -33
Dockerfile CHANGED
@@ -1,33 +1,33 @@
1
- # Stage 1: Build the React application
2
- FROM node:18-alpine AS build
3
-
4
- WORKDIR /app
5
-
6
- COPY package*.json ./
7
-
8
- # Use --legacy-peer-deps to avoid peer dependency conflicts during build
9
- RUN npm install --legacy-peer-deps
10
-
11
- COPY . .
12
-
13
- RUN npm run build
14
-
15
- # Stage 2: Serve the static files with Nginx
16
- FROM nginx:stable-alpine
17
-
18
- # Copy the built static files from the build stage
19
- COPY --from=build /app/build /usr/share/nginx/html
20
-
21
- # Overwrite the default nginx.conf with our custom, self-contained version
22
- # that is designed for restricted, low-permission environments.
23
- COPY nginx.conf /etc/nginx/nginx.conf
24
-
25
- # Expose port 80 for the web server
26
- EXPOSE 80
27
-
28
- # Override the default entrypoint to bypass the base image's setup script,
29
- # which causes permission errors in restricted environments.
30
- ENTRYPOINT ["nginx"]
31
-
32
- # Start Nginx in the foreground. All configuration is now in our custom nginx.conf.
33
- CMD ["-g", "daemon off;"]
 
1
+ # Stage 1: Build the React application
2
+ FROM node:18-alpine AS build
3
+
4
+ WORKDIR /app
5
+
6
+ COPY package*.json ./
7
+
8
+ # Use --legacy-peer-deps to avoid peer dependency conflicts during build
9
+ RUN npm install --legacy-peer-deps
10
+
11
+ COPY . .
12
+
13
+ RUN npm run build
14
+
15
+ # Stage 2: Serve the static files with Nginx
16
+ FROM nginx:stable-alpine
17
+
18
+ # Copy the built static files from the build stage
19
+ COPY --from=build /app/build /usr/share/nginx/html
20
+
21
+ # Overwrite the default nginx.conf with our custom, self-contained version
22
+ # that is designed for restricted, low-permission environments.
23
+ COPY nginx.conf /etc/nginx/nginx.conf
24
+
25
+ # Expose port 8080 for the web server
26
+ EXPOSE 8080
27
+
28
+ # Override the default entrypoint to bypass the base image's setup script,
29
+ # which causes permission errors in restricted environments.
30
+ ENTRYPOINT ["nginx"]
31
+
32
+ # Start Nginx in the foreground. All configuration is now in our custom nginx.conf.
33
+ CMD ["-g", "daemon off;"]