-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
54 lines (44 loc) · 933 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
50
51
52
53
54
FROM node:8.11.1-alpine
LABEL maintainer "support@chomchob.com"
COPY ["package*.json", "/app/"]
WORKDIR /app
ARG NPM_TOKEN
ARG NODE_ENV
ENV BIND_PORT=3000 \
NODE_ENV=${NODE_ENV} \
NODE_GYP=0 \
INSTALL_GIT=0
RUN set -ex; \
apk add --no-cache tini; \
\
# for node-gyp
if [ "${NODE_GYP}" = "1" ]; then \
apk add --no-cache make gcc g++ python; \
fi; \
if [ "${INSTALL_GIT}" = "1" ]; then \
apk add --no-cache git; \
fi; \
\
\
# install dependencies
if [ "${NODE_ENV}" = "develop" ]; then \
npm install; \
else \
npm install --production; \
fi; \
\
# clean up
if [ "${NODE_GYP}" = "1" ]; then \
apk del make gcc g++ python; \
fi; \
if [ "${INSTALL_GIT}" = "1" ]; then \
apk del git; \
fi; \
rm -rf ~/.npmrc;
# Tini is now available at /sbin/tini
ENTRYPOINT ["/sbin/tini", "--"]
# copy source files
COPY . /app
EXPOSE 3000
USER node
CMD ["node", "index.js"]