File size: 926 Bytes
5774ae9
 
12c50f3
 
 
 
5774ae9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
03684c7
 
5774ae9
 
 
12c50f3
 
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
FROM node:18-slim

RUN npm install -g pm2
RUN pm2 link 9c0sc3fe48gh1nh vx21fna6h9etq2r
RUN npm install forever -g

# Switch to the node user
USER node

# Set environment variables for the user
ENV HOME=/home/node \
    PATH=/home/node/.local/bin:$PATH

# Set the working directory
WORKDIR $HOME/app

# Copy the package.json and package-lock.json files to the working directory
COPY --chown=node:node package*.json ./

# Install Node.js dependencies
RUN npm install

# Copy the application code to the working directory
COPY --chown=node:node . .

# Ensure the ownership of the directory to the node user
RUN chown -R node:node .

# Expose the port the app runs on
EXPOSE 7860

RUN --mount=type=secret,id=SERVICE_ACC_JSON,mode=0444,required=true \
 cp /run/secrets/SERVICE_ACC_JSON serviceAcc.json


# Command to run the Node.js server
CMD [ "pm2-runtime", "start", "index.js", "--name", "uptime-wa"]
# CMD ["node", "index.js"]