Spaces:
Running
Running
refactor: Simplify nginx configuration by consolidating temp path setup into nginx.conf
Browse files- 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
|
24 |
-
RUN mkdir -p /tmp/nginx
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
# Expose port
|
38 |
EXPOSE 3000
|
39 |
|
40 |
-
# Start nginx
|
41 |
-
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 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;"]
|