-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
49 lines (34 loc) · 859 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
42
43
44
45
46
47
48
49
#
# -- Base Stage --
#
FROM node:10.11-alpine as base
# Install git and openssh tools
RUN apk apk update && \
apk upgrade && \
# install for bscrypt
apk --no-cache add --virtual builds-deps build-base python
#
# -- Dependencies --
#
FROM base AS dependencies
# set the tmp as workdir
WORKDIR /tmp
# Install app dependencies
COPY package.json .
# install node packages
RUN npm set progress=false \
&& npm config set depth 0 \
&& npm install --only=production
#
# -- Release
#
FROM base AS release
RUN npm install -g pm2
# set the tmp as workdir
WORKDIR /opt/app
# copy all the production only node modules
COPY --from=dependencies /tmp/node_modules ./node_modules
# copy everythings without those indicated in .dockerignore
COPY . .
# run with pm2
CMD [ "pm2-docker", "start" , "server.config.js"]