From 09d8ac1622b3719090133a485f73bbeaad483f6f Mon Sep 17 00:00:00 2001 From: JuniorJPDJ Date: Sat, 10 Jul 2021 06:07:24 +0200 Subject: [PATCH] Don't run nginx as root in docker Signed-off-by: Jacek Pruciak --- Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index c7a6c9d1c1..96573cf09a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,3 +38,9 @@ RUN sed -i '3i\ \ \ \ application/wasm wasm\;' /etc/nginx/mime.types RUN rm -rf /usr/share/nginx/html \ && ln -s /app /usr/share/nginx/html + +RUN mkdir -p /var/log/nginx /var/cache/nginx /var/run/nginx \ + && chown -R nginx:nginx /var/log/nginx /var/run/nginx /var/cache/nginx \ + && sed -e 's#/var/run/nginx.pid#/var/run/nginx/nginx.pid#' -i /etc/nginx/nginx.conf + +USER nginx