-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
43 lines (30 loc) · 1.07 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
FROM node:lts-alpine3.15
RUN apk -U upgrade \
&& apk add --no-cache \
git \
openssh
## Install Nginx (used for zero downtime)
#RUN apk add nginx
#COPY ./nginx/nginx.conf /etc/nginx/nginx.conf
RUN mkdir -p /usr/src/app
# Create app directory
WORKDIR /usr/src/app
# Install system app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN echo "`date +\"%Y-%m-%dT%H:%M:%S%z\"`" > ./image-build-time.txt
RUN echo "`date +%s`" > ./image-build-timestamp.txt
RUN ["npm", "install"]
# If you are building your code for production
# RUN npm ci --only=production
# Bundle app source
COPY . .
# Install node_modules in metadata folder on build
RUN cd ./metadata && npm install --only=production
# At the point of building image we also want to move metadata folder with npm modules to data/metadata-examples
RUN cp -r ./metadata/* ./data/metadata-examples
# Install PM2 globally
RUN npm install pm2 -g
# CMD ["npm", "run", "start"]
CMD [ "pm2-runtime", "start", "ecosystem.config.cjs" ]