Skip to content

Commit

Permalink
Hotfix support docker image for non-root nginx use (#3396)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
raikbitters authored and AmsterGet committed May 15, 2023
1 parent 2cd6c09 commit e7bfb4a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ build/
*.iws
*.log
.vscode
.devcontainer

coverage

Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
FROM nginx:alpine
FROM nginxinc/nginx-unprivileged:alpine

LABEL maintainer="Andrei Varabyeu <andrei_varabyeu@epam.com>"
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
9 changes: 8 additions & 1 deletion Dockerfile-full
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit e7bfb4a

Please sign in to comment.