File size: 658 Bytes
ee426b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use Node.js as base image
FROM node:14

# Install PM2 and NGINX
RUN npm install -g pm2 \
    && apt-get update \
    && apt-get install -y nginx

# Set working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy app.js and generate-config.js
COPY app.js .
COPY generate-config.js .

# Copy NGINX main config file
COPY nginx.conf /etc/nginx/

# Generate config files and start the applications at runtime
CMD ["sh", "-c", "node generate-config.js && cp default.conf /etc/nginx/conf.d/ && pm2 start ecosystem.config.js && nginx -g 'daemon off;'"]

# Expose ports
EXPOSE 7860