This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new d486728e0 [hotfix] Improve nginx container behaviour when starting as
non-root user (#1661)
d486728e0 is described below
commit d486728e09fc7ae83db543c1cc34918de7b41afd
Author: Dominik Riemer <[email protected]>
AuthorDate: Tue Jun 6 10:57:55 2023 +0200
[hotfix] Improve nginx container behaviour when starting as non-root user
(#1661)
---
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;