Switched to non root user and alpine.

This commit is contained in:
James Blair 2020-06-16 18:21:17 +12:00
parent 4d27b928d8
commit 961ff38eb5

View File

@ -1,4 +1,4 @@
FROM node:12 as builder
FROM node:12-alpine as builder
WORKDIR /usr/src/app
@ -7,9 +7,12 @@ COPY ui/ .
RUN yarn install --frozen-lockfile
RUN yarn export
FROM node:12
FROM node:12-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
WORKDIR /usr/src/app
COPY api/ .
@ -27,4 +30,7 @@ ENV PORT=3000 \
EXPOSE 3000
# Change to non-root privilege
USER ohmyform
CMD [ "yarn", "start:prod" ]