forked from LAB-MI/candilib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
58 lines (50 loc) · 1.68 KB
/
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
55
56
57
58
FROM node:8 as base
ARG proxy
ARG npm_registry
# ARG sass_registry
ARG no_proxy
ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
EXPOSE 8000
RUN if [ ! -z "$proxy" ] ; then \
npm config delete proxy; \
npm config set proxy $proxy; \
npm config set https-proxy $proxy ; \
npm config set no-proxy $no_proxy; \
fi ; \
[ -z "$npm_registry" ] || npm config set registry=$npm_registry ; \
npm install pm2 -g
#RUN npm install pm2 -g
FROM base as development
ENV NODE_ENV development
COPY package.json package-lock.json ./
RUN if [ ! -z "$proxy" ] ; then \
npm config delete proxy; \
npm config set proxy $proxy; \
npm config set https-proxy $proxy ; \
fi ; \
[ -z "$npm_registry" ] || npm config set registry=$npm_registry ; \
npm install
COPY .env server/inbox/sites.json .babelrc index.js nodemon.json webpack.config.babel.js webpack.config.dev.js webpack.config.prod.js webpack.config.server.js ./
COPY client ./client
COPY Intl ./Intl
COPY server ./server
CMD ["npm", "start"]
FROM development as build
ENV NODE_ENV=production
RUN npm run build && npm run build:server
FROM base as production
ENV NODE_ENV=production
COPY package.json package-lock.json processes.json ./
RUN if [ ! -z "$proxy" ] ; then \
npm config delete proxy; \
npm config set proxy $proxy; \
npm config set https-proxy $proxy ; \
fi ; \
[ -z "$npm_registry" ] || npm config set registry=$npm_registry ; \
npm install --production
COPY index.js .env ./
COPY --from=build /usr/src/app/dist ./dist
CMD ["pm2-runtime", "processes.json"]