-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
40 lines (33 loc) · 1.19 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
# Node image
FROM node:slim
# Create directory for server node.js files
WORKDIR /app
# Copy all project files except ignored in .dockerignore
ADD . /app
# Upgrade all system dependencies
RUN apt-get update && apt-get upgrade -y
# Install pm2 and project dependencies
RUN mv config.json.example config.json
RUN npm install pm2 -g
RUN apt-get update && apt-get install -y git
RUN npm i --force
ENV NODE_ENV production
RUN npx webpack build --config webpack.config.js
RUN rm -rf node_modules
RUN npm install --production
# point out ports
EXPOSE 7000-8000
ENV SERVICE_TYPE rd
ENV PEER_HOST https://0.0.0.0
ENV PEER_PORT 7001
ENV CONTAINER_PORT 7071
ENV PASSWORD root
ENV OPENED_PORT 80
CMD cd server/scripts/ ;\
if [ "$SERVICE_TYPE" = "rd" ] ; then \
pm2-runtime start rd.js -- --peer ${PEER_HOST}:${PEER_PORT} --port ${CONTAINER_PORT} --p ${PASSWORD} --o_port ${OPENED_PORT} ;\
elif [ "$SERVICE_TYPE" = "fl" ] ; then \
pm2-runtime start fl.js -- --peer ${PEER_HOST}:${PEER_PORT} --port ${CONTAINER_PORT} --p ${PASSWORD} ;\
elif [ "$SERVICE_TYPE" = "ddl" ] ; then \
pm2-runtime start ddl.js -- --peer ${PEER_HOST}:${PEER_PORT} --port ${CONTAINER_PORT} --p ${PASSWORD} ;\
fi