Skip to content
Snippets Groups Projects
Commit 6408d123 authored by Rémi PAILHAREY's avatar Rémi PAILHAREY :fork_knife_plate:
Browse files

fix: nginx unprivileged image

parent d3ebb78f
No related branches found
No related tags found
1 merge request!79Fix: nginx unprivileged image
...@@ -9,9 +9,9 @@ COPY ./ /app/ ...@@ -9,9 +9,9 @@ COPY ./ /app/
RUN yarn build RUN yarn build
# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx # Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:1.16 FROM nginxinc/nginx-unprivileged:1.23
COPY --from=build-stage /app/build/ /usr/share/nginx/html COPY --from=build-stage /app/build/ /usr/share/nginx/html
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./nginx/site.prod.conf /etc/nginx/conf.d/default.conf COPY ./nginx/site.prod.conf /etc/nginx/conf.d/default.conf
EXPOSE 80 EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file
version: '3.7' version: '3.7'
services: services:
nginx: nginx:
image: nginx:1.16 image: nginxinc/nginx-unprivileged:1.23
volumes: volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf - ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/site.conf:/etc/nginx/conf.d/default.conf - ./nginx/site.conf:/etc/nginx/conf.d/default.conf
......
worker_processes auto; worker_processes auto;
error_log /var/log/nginx/error.log warn; error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid; pid /tmp/nginx.pid;
events { events {
worker_connections 1024; worker_connections 1024;
......
...@@ -24,6 +24,9 @@ server { ...@@ -24,6 +24,9 @@ server {
location /swagger { location /swagger {
proxy_pass https://backend:1443/swagger; proxy_pass https://backend:1443/swagger;
} }
location /imageNames {
proxy_pass https://backend:1443/api/admin/imageNames;
}
location /assets { location /assets {
proxy_pass https://backend:1443/assets; proxy_pass https://backend:1443/assets;
} }
......
server { server {
listen 8080; listen 8080;
server_name ecolyo-agent.self-data.alpha.grandlyon.com; server_name ecolyo-agent.apps.grandlyon.com;
location / { location / {
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html index.htm; index index.html index.htm;
try_files $uri $uri/ /index.html =404; try_files $uri $uri/ /index.html =404;
} }
location /api { location /api {
proxy_pass https://backend:1443/api; proxy_pass https://backend:1443/api;
} }
...@@ -26,13 +25,8 @@ server { ...@@ -26,13 +25,8 @@ server {
location /imageNames { location /imageNames {
proxy_pass https://backend:1443/api/admin/imageNames; proxy_pass https://backend:1443/api/admin/imageNames;
} }
location /assets {
location ~ ^/assets/(.+\.(?:gif|jpe?g|svg))$ { proxy_pass https://backend:1443/assets;
alias /usr/share/nginx/html/lib/$1;
gzip_static on;
expires max;
add_header Cache-Control public;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment