From ecdc079ff3e14eb66a5c410e47bd2b7ff79e77f1 Mon Sep 17 00:00:00 2001 From: cde-barros Date: Tue, 5 Dec 2023 15:01:00 +0100 Subject: [PATCH] image nginx unprivileged --- tools/docker/Dockerfile | 8 ++++++-- tools/docker/nginx.ign.conf | 10 ++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 614854b44b..86413e4dd3 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -1,7 +1,11 @@ # This dockerfile should work for all traditional apps, # i.e. it only sets up a nginx server with the app dist folder -FROM nginx:1.24-alpine +FROM nginxinc/nginx-unprivileged:1.24 + +USER root +RUN rm -rf /usr/share/nginx/html/* +USER nginx ARG APP_NAME="search" ENV APP_NAME=${APP_NAME} @@ -21,6 +25,6 @@ COPY tools/webcomponent/wc-embedder.html /usr/share/nginx/html/${APP_NAME} COPY tools/docker/nginx.ign.conf /etc/nginx/conf.d/default.conf RUN sed -i "s/APP_NAME/${APP_NAME}/" /etc/nginx/conf.d/default.conf -EXPOSE 80 +EXPOSE 8080 ENTRYPOINT ["sh", "/docker-entrypoint.sh", "nginx", "-g", "daemon off;"] diff --git a/tools/docker/nginx.ign.conf b/tools/docker/nginx.ign.conf index ae23705a8e..a261a23e30 100644 --- a/tools/docker/nginx.ign.conf +++ b/tools/docker/nginx.ign.conf @@ -1,6 +1,6 @@ server { - listen 80; - listen [::]:80; + listen 8080; + listen [::]:8080; server_name localhost; root /usr/share/nginx/html/datahub; @@ -22,6 +22,12 @@ server { add_header Cache-Control 'max-age=86400'; # 24h } + location /catalogue { + try_files $uri$args $uri$args/ /index.html; + + add_header Cache-Control 'max-age=86400'; # 24h + } + error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html;