Merge pull request #45 from ahmedkrmn/non-root-user-docker

Modify docker file to use non-root user 
fixes #43
This commit is contained in:
Leopere 2019-10-10 05:46:20 -04:00 committed by GitHub
commit 44f5d688e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,9 @@
FROM node:10-alpine
LABEL maintainer="OhMyForm <admin@ohmyform.com>"
# Create a group and a user with name "ohmyform".
RUN addgroup --gid 9999 ohmyform && adduser -D --uid 9999 -G ohmyform ohmyform
# Install some needed packages
RUN apk add --no-cache git=2.20.1-r0 python=2.7.16-r1 \
&& rm -rf /tmp/* \
@ -48,5 +51,8 @@ RUN npm install --only=production \
&& bower install --allow-root -f \
&& grunt build
# Change to non-root privilege
USER ohmyform
# Run OhMyForm server
CMD ["node", "server.js"]