eli02 commited on
Commit
eaada64
·
1 Parent(s): 7d9316a

feat: Enhance nginx configuration with additional temp directories and buffer settings

Browse files
Files changed (4) hide show
  1. Dockerfile +16 -2
  2. nginx.conf +5 -1
  3. package-lock.json +2 -2
  4. package.json +2 -2
Dockerfile CHANGED
@@ -20,8 +20,22 @@ FROM nginx:alpine
20
  COPY --from=build /app/build /usr/share/nginx/html
21
  COPY nginx.conf /etc/nginx/conf.d/default.conf
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  # Expose port
24
  EXPOSE 3000
25
 
26
- # Start nginx
27
- CMD ["nginx", "-g", "daemon off;"]
 
20
  COPY --from=build /app/build /usr/share/nginx/html
21
  COPY nginx.conf /etc/nginx/conf.d/default.conf
22
 
23
+ # Create directories in /tmp which is typically writable
24
+ RUN mkdir -p /tmp/nginx/client_temp \
25
+ /tmp/nginx/proxy_temp \
26
+ /tmp/nginx/fastcgi_temp \
27
+ /tmp/nginx/uwsgi_temp \
28
+ /tmp/nginx/scgi_temp
29
+
30
+ # Create custom nginx config that uses /tmp for cache
31
+ RUN echo 'client_body_temp_path /tmp/nginx/client_temp;\
32
+ proxy_temp_path /tmp/nginx/proxy_temp;\
33
+ fastcgi_temp_path /tmp/nginx/fastcgi_temp;\
34
+ uwsgi_temp_path /tmp/nginx/uwsgi_temp;\
35
+ scgi_temp_path /tmp/nginx/scgi_temp;' > /etc/nginx/temp_paths.conf
36
+
37
  # Expose port
38
  EXPOSE 3000
39
 
40
+ # Start nginx with our custom config
41
+ CMD ["nginx", "-g", "daemon off; include /etc/nginx/temp_paths.conf;"]
nginx.conf CHANGED
@@ -1,5 +1,5 @@
1
  server {
2
- listen 3000; # Changed from 80 to 3000 for HF Spaces
3
  server_name localhost;
4
 
5
  location / {
@@ -15,6 +15,10 @@ server {
15
  proxy_set_header X-Real-IP $remote_addr;
16
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
17
  proxy_set_header X-Forwarded-Proto $scheme;
 
 
 
 
18
  }
19
 
20
  error_page 500 502 503 504 /50x.html;
 
1
  server {
2
+ listen 3000;
3
  server_name localhost;
4
 
5
  location / {
 
15
  proxy_set_header X-Real-IP $remote_addr;
16
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
17
  proxy_set_header X-Forwarded-Proto $scheme;
18
+
19
+ # Add proxy buffer configuration to avoid disk writes
20
+ proxy_buffers 16 16k;
21
+ proxy_buffer_size 16k;
22
  }
23
 
24
  error_page 500 502 503 504 /50x.html;
package-lock.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:71e356408d9a86a21eead4ae57ee1cda2be973e815e4a627e67df124a3dd0f5a
3
- size 676451
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:135b04ad1cc47ce2c997295604e3382057b36514ca90b07999cfe9ef03b25309
3
+ size 676514
package.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e608424869e0ed703e601a85028efaa3b2d1b05d0211fda96887bff1dd8feee8
3
- size 863
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0da3266e294b5a476b389556896c26183a636c3ae6d0e90db30e53481c377ee2
3
+ size 915