Skip to content

Commit

Permalink
Update node-armhf template to use non-root user
Browse files Browse the repository at this point in the history
This updates the node-armhf function template to use a non-root
user. Creates `app` system user  and `app` group

Signed-off-by: Ivana Yovcheva (VMware) <iyovcheva@vmware.com>
  • Loading branch information
ivanayov authored and alexellis committed Feb 5, 2020
1 parent aa857f0 commit 94e53f4
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions template/node-armhf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,36 @@ FROM node:12.13.0-alpine as ship
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
RUN chmod +x /usr/bin/fwatchdog

RUN addgroup -S app && adduser app -S -G app

RUN apk add --no-cache nodejs nodejs-npm ca-certificates

WORKDIR /root/
RUN mkdir -p /home/app

# Wrapper/boot-strapper
WORKDIR /home/app

COPY package.json .

RUN npm i

WORKDIR /home/app/function

COPY index.js .
COPY function function
WORKDIR /root/function

ENV NPM_CONFIG_LOGLEVEL warn
RUN npm i || :
WORKDIR /root/

COPY --chown=app:app function/ .

WORKDIR /home/app/

RUN chmod +rx -R ./function \
&& chown app:app -R /home/app \
&& chmod 777 /tmp

USER app

ENV cgi_headers="true"

Expand Down

0 comments on commit 94e53f4

Please sign in to comment.