forked from ohmyform/ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
37 lines (23 loc) · 839 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM node:12-alpine AS builder
MAINTAINER OhMyForm <admin@ohmyform.com>
WORKDIR /usr/src/app
RUN apk update && apk add curl bash && rm -rf /var/cache/apk/*
# install node-prune (https://github.com/tj/node-prune)
RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin
COPY . ./
RUN yarn install --frozen-lock-file
RUN yarn build
# remove development dependencies
RUN npm prune --production
# run node prune
RUN /usr/local/bin/node-prune
FROM node:12-alpine
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 --from=builder /usr/src/app /usr/src/app
ENV PORT=4000
# Change to non-root privilege
USER ohmyform
CMD [ "yarn", "start" ]