Explorar o código

Merge pull request #1947 from allianz-direct/enable-image-to-run-nonroot

Enabling UI image to run as non-root
Matt Ray %!s(int64=2) %!d(string=hai) anos
pai
achega
9ae9cb21f9
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      ui/Dockerfile

+ 8 - 0
ui/Dockerfile

@@ -9,9 +9,17 @@ FROM nginx:alpine
 COPY --from=builder /opt/ui/dist /var/www
 COPY default.nginx.conf /etc/nginx/conf.d/
 COPY nginx.conf /etc/nginx/
+RUN rm -rf /etc/nginx/conf.d/default.conf
+
+RUN adduser 1001 -g 1000 -D
+RUN chown 1001:1000 -R /var/www
+RUN chown 1001:1000 -R /etc/nginx
 
 ENV BASE_URL=/model
 
+
+USER 1001
+
 COPY ./docker-entrypoint.sh /usr/local/bin/
 ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
 CMD ["nginx", "-g", "daemon off;"]