Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #87 from kgudel/nonroot
Browse files Browse the repository at this point in the history
Set user as nonroot with shadow
  • Loading branch information
wpears authored Jul 18, 2019
2 parents ee19cfc + 7756d51 commit 858d620
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
18 changes: 11 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ COPY public ./public

RUN yarn build

FROM nginx:1.15.12-alpine
ENV NGINX_USER=nginx
FROM nginx:1.16-alpine
ENV NGINX_USER=svc_nginx_hmda
RUN rm -rf /etc/nginx/conf.d
COPY nginx /etc/nginx
COPY --from=build-stage /usr/src/app/build /usr/share/nginx/html/hmda-help
RUN apk --no-cache add shadow && \
usermod -l $NGINX_USER nginx && \
groupmod -n $NGINX_USER nginx && \
chown -R $NGINX_USER:$NGINX_USER /etc/nginx /usr/share/nginx/html/hmda-help
EXPOSE 80
RUN adduser -S $NGINX_USER nginx && \
addgroup -S $NGINX_USER && \
addgroup $NGINX_USER $NGINX_USER && \
touch /run/nginx.pid && \
chown -R $NGINX_USER:$NGINX_USER /etc/nginx /run/nginx.pid /var/cache/nginx/

EXPOSE 8080

USER svc_nginx_hmda
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion kubernetes/hmda-help/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: 80
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/hmda-help/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fullnameOverride: ''

service:
type: ClusterIP
port: 80
port: 8080

#ambassador:
# service:
Expand Down
2 changes: 1 addition & 1 deletion nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ http {
}

server {
listen 80;
listen 8080;
root /usr/share/nginx/html/;
autoindex off;
access_log /dev/stdout;
Expand Down

0 comments on commit 858d620

Please sign in to comment.