This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch improve-non-root-ui-image
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 64f5ddece1fadeef05d8832a1f1d1615d54fd998
Author: Dominik Riemer <[email protected]>
AuthorDate: Tue Jun 6 10:36:19 2023 +0200

    [hotfix] Improve nginx container behaviour when starting as non-root user
---
 ui/Dockerfile              | 13 +++++++++++++
 ui/nginx_config/nginx.conf |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ui/Dockerfile b/ui/Dockerfile
index 0bbc4af52..8f204bd12 100644
--- a/ui/Dockerfile
+++ b/ui/Dockerfile
@@ -25,6 +25,11 @@ RUN chown -R nginx:nginx /usr/share/nginx/html && chmod -R 
755 /usr/share/nginx/
 RUN touch /var/run/nginx.pid && \
         chown -R nginx:nginx /var/run/nginx.pid
 
+RUN chown -R nginx:nginx /etc/nginx/
+RUN chown -R nginx:nginx /usr/share/nginx/html/
+RUN chown -R nginx:nginx /var/cache/nginx/
+RUN chown -R nginx:nginx /var/run/
+
 USER nginx
 
 COPY nginx_config/nginx.conf /etc/nginx/nginx.conf
@@ -33,5 +38,13 @@ COPY nginx_config/ssl.conf /app/nginx-confs/ssl.conf
 
 COPY docker-entrypoint.sh /
 
+RUN mkdir -p /var/cache/nginx/client_temp
+RUN mkdir -p /var/cache/nginx/proxy_temp
+RUN mkdir -p /var/cache/nginx/fastcgi_temp
+RUN mkdir -p /var/cache/nginx/scgi_temp
+RUN mkdir -p /var/cache/nginx/uwsgi_temp
+
+USER 101:101
+
 ENTRYPOINT ["sh", "/docker-entrypoint.sh"]
 CMD ["nginx", "-g", "daemon off;"]
diff --git a/ui/nginx_config/nginx.conf b/ui/nginx_config/nginx.conf
index 68d7ee899..aecd39386 100644
--- a/ui/nginx_config/nginx.conf
+++ b/ui/nginx_config/nginx.conf
@@ -14,7 +14,7 @@
 # limitations under the License.
 
 
-user  root;
+user nginx;
 worker_processes  1;
 
 error_log  /var/log/nginx/error.log warn;

Reply via email to