-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
34 lines (27 loc) · 871 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
# Define image to build from - Use the latest LTS
FROM node:8
# Define where to hold the application code inside the image - Create app directory
WORKDIR /usr/src/app
# Use npm binary to install dependencies - Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
# Install Production Runtime and Process Manager for Node.js
RUN npm install pm2 -g
# Development Build
RUN npm install
# Production Build
#RUN npm install --only=production
# Bundle app source
COPY . .
#Set ENV Variable
ENV node = "development"
# Add ENV value to be used
ADD . $node
# Bind ports to have mapped by the docker daemon
EXPOSE 3000
# Define the command to run app
# Run development version
CMD ["pm2-runtime","npm", "--","start"]
# Run production version
# CMD ["npm","run","build"]