Anirudha Soni commited on
Commit
eb76662
·
1 Parent(s): 155853a

Update docker, nginx

Browse files
Files changed (2) hide show
  1. Dockerfile +6 -6
  2. nginx.conf +22 -7
Dockerfile CHANGED
@@ -12,14 +12,14 @@ FROM nginx:alpine
12
 
13
  # Copy React build
14
  COPY --from=build /app/dist /usr/share/nginx/html
 
15
 
16
- # Copy custom config
17
- COPY nginx.conf /etc/nginx/conf.d/default.conf
18
 
19
- # Remove PID directive from nginx.conf to avoid permission issues
20
- RUN sed -i '/pid\s\+/d' /etc/nginx/nginx.conf && \
21
- mkdir -p /tmp/nginx /var/cache/nginx && \
22
  chmod -R 777 /tmp/nginx /var/cache/nginx
23
 
24
  EXPOSE 7860
25
- CMD ["nginx", "-g", "daemon off;"]
 
12
 
13
  # Copy React build
14
  COPY --from=build /app/dist /usr/share/nginx/html
15
+ # (if CRA, replace dist with build)
16
 
17
+ # Override full nginx.conf
18
+ COPY nginx.conf /etc/nginx/nginx.conf
19
 
20
+ # Ensure writable dirs
21
+ RUN mkdir -p /tmp/nginx /var/cache/nginx && \
 
22
  chmod -R 777 /tmp/nginx /var/cache/nginx
23
 
24
  EXPOSE 7860
25
+ CMD ["nginx", "-g", "daemon off;"]
nginx.conf CHANGED
@@ -1,11 +1,26 @@
1
- server {
2
- listen 7860;
3
- server_name localhost;
4
 
5
- root /usr/share/nginx/html;
6
- index index.html;
7
 
8
- location / {
9
- try_files $uri /index.html;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  }
11
  }
 
1
+ worker_processes 1;
 
 
2
 
3
+ # Write pid to /tmp (writable by non-root)
4
+ pid /tmp/nginx.pid;
5
 
6
+ events { worker_connections 1024; }
7
+
8
+ http {
9
+ include mime.types;
10
+ default_type application/octet-stream;
11
+
12
+ sendfile on;
13
+ keepalive_timeout 65;
14
+
15
+ server {
16
+ listen 7860;
17
+ server_name localhost;
18
+
19
+ root /usr/share/nginx/html;
20
+ index index.html;
21
+
22
+ location / {
23
+ try_files $uri /index.html;
24
+ }
25
  }
26
  }