Adding non-root user to dockerfiles of litmus portal (#2380)

Signed-off-by: Raj Babu Das <raj.das@mayadata.io>
This commit is contained in:
Raj Babu Das 2020-12-15 22:32:08 +05:30 committed by GitHub
parent ee61fa2b7d
commit 655698dba7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 37 deletions

View File

@ -12,6 +12,10 @@ FROM alpine:latest
LABEL maintainer="LitmusChaos"
COPY --from=builder /output/server /
RUN addgroup -S litmus && adduser -S -G litmus 1001
USER 1001
CMD ["./server"]
EXPOSE 3000

View File

@ -14,4 +14,8 @@ FROM alpine:3.12.0
LABEL maintainer="LitmusChaos"
COPY --from=builder /output/subscriber /
RUN addgroup -S litmus && adduser -S -G litmus 1001
USER 1001
CMD ["./subscriber"]

View File

@ -23,7 +23,7 @@ COPY . ./
RUN npm run build
# Stage 2: the production environment
FROM nginx:alpine
FROM nginxinc/nginx-unprivileged:1.18-alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=react-build /frontend/build /usr/share/nginx/html

View File

@ -1,36 +0,0 @@
# Docker Image which is used as foundation to create
# a custom Docker Image with this Dockerfile
FROM node:12.18.0 as react-build
# Add Maintainer Info
LABEL maintainer="LitmusChaos"
# A directory within the virtualized Docker environment
# Becomes more relevant when using Docker Compose later
WORKDIR /frontend
# Copies package.json and package-lock.json to Docker environment
COPY package.json ./
COPY package-lock.json ./
# Installs all node packages except Cypress
RUN CYPRESS_INSTALL_BINARY=0 npm install
# Copies everything over to Docker environment
COPY . ./
# Finally runs the application
RUN npm run build
# Stage 2: the production environment
FROM nginxinc/nginx-unprivileged
# Add Maintainer Info
LABEL maintainer="LitmusChaos"
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=react-build /frontend/build /usr/share/nginx/html
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]

View File

@ -14,6 +14,10 @@ LABEL maintainer="LitmusChaos"
COPY --from=builder /output/server /
COPY --from=builder /gql-server/manifests/. /manifests
RUN addgroup -S litmus && adduser -S -G litmus 1001
USER 1001
CMD ["./server"]
EXPOSE 8080