eli02 commited on
Commit
35c6be3
·
1 Parent(s): eaada64

refactor: Simplify nginx configuration by consolidating temp path setup into nginx.conf

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -15
Dockerfile CHANGED
@@ -20,22 +20,34 @@ 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
- # 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;"]
 
20
  COPY --from=build /app/build /usr/share/nginx/html
21
  COPY nginx.conf /etc/nginx/conf.d/default.conf
22
 
23
+ # Create a proper nginx.conf with temp paths in the http context
24
+ RUN mkdir -p /tmp/nginx && \
25
+ { \
26
+ echo 'user nginx;'; \
27
+ echo 'worker_processes auto;'; \
28
+ echo 'error_log /var/log/nginx/error.log notice;'; \
29
+ echo 'pid /tmp/nginx.pid;'; \
30
+ echo 'events {'; \
31
+ echo ' worker_connections 1024;'; \
32
+ echo '}'; \
33
+ echo 'http {'; \
34
+ echo ' include /etc/nginx/mime.types;'; \
35
+ echo ' default_type application/octet-stream;'; \
36
+ echo ' client_body_temp_path /tmp/nginx/client_temp;'; \
37
+ echo ' proxy_temp_path /tmp/nginx/proxy_temp;'; \
38
+ echo ' fastcgi_temp_path /tmp/nginx/fastcgi_temp;'; \
39
+ echo ' uwsgi_temp_path /tmp/nginx/uwsgi_temp;'; \
40
+ echo ' scgi_temp_path /tmp/nginx/scgi_temp;'; \
41
+ echo ' log_format main "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" \"$http_x_forwarded_for\"";'; \
42
+ echo ' access_log /var/log/nginx/access.log main;'; \
43
+ echo ' sendfile on;'; \
44
+ echo ' keepalive_timeout 65;'; \
45
+ echo ' include /etc/nginx/conf.d/*.conf;'; \
46
+ echo '}'; \
47
+ } > /etc/nginx/nginx.conf
48
 
49
  # Expose port
50
  EXPOSE 3000
51
 
52
+ # Start nginx without the problematic include
53
+ CMD ["nginx", "-g", "daemon off;"]