forked from HospitalRun/hospitalrun-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
41 lines (28 loc) · 875 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
38
39
40
41
FROM node:10-alpine as build
LABEL maintainer="Michael Feher, Matteo Vivona, Maksim Sinik"
# set app basepath
ENV HOME=/home/app
# copy all app files
COPY . $HOME/node/
# change workgin dir and install deps in quiet mode
WORKDIR $HOME/node
RUN npm ci -q
# compile typescript and build all production stuff
RUN npm run build
# remove dev dependencies that are not needed in production
RUN npm prune --production
# start new image for lower size
FROM node:10-alpine
# create use with no permissions
RUN addgroup -g 101 -S app && adduser -u 100 -S -G app -s /bin/false app
# set app basepath
ENV HOME=/home/app
# copy production complied node app to the new image
COPY --from=build $HOME/node/ $HOME/node/
RUN chown -R app:app $HOME/*
# run app with low permissions level user
USER app
WORKDIR $HOME/node
EXPOSE 3000
ENV NODE_ENV=production
CMD [ "yarn", "start" ]