forked from gavbn/tcloud-1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (34 loc) · 800 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
FROM node:alpine
LABEL maintainer="contact@lunik.xyz"
ENV NODE_ENV=production
# Preinstall production dependencies
WORKDIR /usr/src/app
COPY package.json .
RUN npm install && \
cp ./package.json /tmp && \
cp -r ./node_modules /tmp
# Build app
ENV NODE_ENV=dev
WORKDIR /tmp
COPY . /tmp
RUN npm install && \
npm run build && \
mv ./build/* /usr/src/app && \
rm -r /tmp/* && \
npm cache clean --force
ENV NODE_ENV=production
# Configurations
WORKDIR /usr/src/app
# Set config path
RUN mkdir /usr/config
ENV CONFIG_PATH=/usr/config/config.json
# Expose ports
EXPOSE 80
EXPOSE 443
# expose volumes
VOLUME ["/usr/src/app/files"]
VOLUME ["/usr/src/app/logs"]
VOLUME ["/usr/src/app/database"]
VOLUME ["/usr/config"]
# start command
CMD ["/usr/local/bin/node", "./server.js"]