Trigger82 commited on
Commit
8e2568e
·
verified ·
1 Parent(s): 4d87935

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -6
Dockerfile CHANGED
@@ -1,17 +1,26 @@
1
  FROM node:23
2
 
 
 
3
  WORKDIR /app
4
 
5
- # Install PM2 globally for process management
6
  RUN npm install -g pm2
7
 
8
- COPY package*.json ./
 
 
 
 
 
 
9
  RUN npm install
10
 
11
- COPY . .
 
12
 
13
- # Expose the main port
14
  EXPOSE 7860
15
 
16
- # Start the application using PM2 to ensure 24/7 operation
17
- CMD ["pm2-runtime", "start", "server.js"]
 
1
  FROM node:23
2
 
3
+ # Create app directory with proper permissions
4
+ RUN mkdir -p /app/users && chown -R node:node /app
5
  WORKDIR /app
6
 
7
+ # Install PM2 globally (no keys needed for basic usage)
8
  RUN npm install -g pm2
9
 
10
+ # Switch to non-root user
11
+ USER node
12
+
13
+ # Copy package files first for better caching
14
+ COPY --chown=node:node package*.json ./
15
+
16
+ # Install dependencies
17
  RUN npm install
18
 
19
+ # Copy application files
20
+ COPY --chown=node:node . .
21
 
22
+ # Expose the port
23
  EXPOSE 7860
24
 
25
+ # Start the application (no PM2 keys required)
26
+ CMD ["pm2-runtime", "--no-daemon", "server.js"]