From ad45a5268e8bd5e286eb443685034a3978fc7f22 Mon Sep 17 00:00:00 2001 From: Lev Vereshchagin Date: Mon, 20 Dec 2021 10:42:35 +0300 Subject: [PATCH] Use `nginxinc/nginx-unprivileged` instead of `nginx` image Also use Ngnix 1.20 instead of unstable 1.21 --- build/nginx/Dockerfile | 5 +++-- build/nginx/nginx-template.conf | 2 +- compose.yaml | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build/nginx/Dockerfile b/build/nginx/Dockerfile index db062b05..b6413bda 100644 --- a/build/nginx/Dockerfile +++ b/build/nginx/Dockerfile @@ -67,8 +67,7 @@ FROM base as error_pages RUN git clone --depth 1 https://github.com/frappe/bench /root/bench - -FROM nginx:1.21-alpine as frappe +FROM nginxinc/nginx-unprivileged:1.20-alpine as frappe COPY --from=error_pages /root/bench/bench/config/templates/502.html /usr/share/nginx/html COPY --from=base /root/frappe-bench/apps/frappe/frappe/public /usr/share/nginx/html/assets/frappe @@ -77,6 +76,8 @@ COPY --from=frappe_assets /root/frappe-bench/sites /usr/share/nginx/html COPY nginx-template.conf / +USER 1001 + CMD [ "/bin/sh" , "-c" , "envsubst '${BACKEND} ${SOCKETIO} ${FRAPPE_SITE_NAME_HEADER}' /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'" ] diff --git a/build/nginx/nginx-template.conf b/build/nginx/nginx-template.conf index f21c2631..42547fe0 100644 --- a/build/nginx/nginx-template.conf +++ b/build/nginx/nginx-template.conf @@ -7,7 +7,7 @@ upstream socketio-server { } server { - listen 80; + listen 8080; server_name $http_host; root /usr/share/nginx/html; diff --git a/compose.yaml b/compose.yaml index e85cd0b3..ceb9d8b0 100644 --- a/compose.yaml +++ b/compose.yaml @@ -65,7 +65,7 @@ services: - websocket labels: - traefik.enable=true - - traefik.http.services.frontend.loadbalancer.server.port=80 + - traefik.http.services.frontend.loadbalancer.server.port=8080 - traefik.http.routers.frontend-http.entrypoints=web - traefik.http.routers.frontend-http.rule=HostRegexp(`{any:.+}`)