From e7bfb4a3ef75afa48af6b30f463dbcf041a54004 Mon Sep 17 00:00:00 2001 From: Reingold Shekhtel <13565058+raikbitters@users.noreply.github.com> Date: Mon, 10 Apr 2023 13:13:45 +0400 Subject: [PATCH] Hotfix support docker image for non-root nginx use (#3396) * Add docker image for nginx non-root using * Change default Dockerfile for non-root use Swipe nginx base image on nginx-unprivileged * Add nginx-unprivileged for Dockerfile-full * Update version to 5.7.4 --- .gitignore | 1 + Dockerfile | 7 +++++-- Dockerfile-full | 9 ++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d3cc95d3f6..3ad3f88e52 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ build/ *.iws *.log .vscode +.devcontainer coverage diff --git a/Dockerfile b/Dockerfile index 553aac2792..66100029e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,17 @@ -FROM nginx:alpine +FROM nginxinc/nginx-unprivileged:alpine LABEL maintainer="Andrei Varabyeu " LABEL version=5.7.4 ENV APP_DOWNLOAD_URL https://github.com/reportportal/service-ui/releases/download/v5.7.4 +USER root ADD ${APP_DOWNLOAD_URL}/ui.tar.gz / RUN tar -zxvf ui.tar.gz -C /usr/share/nginx/html && rm -f ui.tar.gz RUN rm /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/nginx.conf -EXPOSE 8080 +USER $UID + +EXPOSE 8080 \ No newline at end of file diff --git a/Dockerfile-full b/Dockerfile-full index d776921e40..e254467f3e 100644 --- a/Dockerfile-full +++ b/Dockerfile-full @@ -1,4 +1,5 @@ # Only for technical/build aims, built image will be with nginx:alpine according to the last step + FROM alpine:3.10.9 as generate-build-info RUN apk add git RUN apk add make @@ -15,10 +16,16 @@ COPY ./app/ /usr/src/app/ RUN export NODE_OPTIONS="--max-old-space-size=4096" RUN npm ci && npm run build && npm run test -FROM nginx:alpine +FROM nginxinc/nginx-unprivileged:alpine + +USER root + COPY --from=build-frontend /usr/src/app/build /usr/share/nginx/html COPY --from=generate-build-info /usr/src/app/build /usr/share/nginx/html + RUN rm /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/nginx.conf +USER $UID + EXPOSE 8080