jbilcke-hf HF staff commited on
Commit
d94e568
1 Parent(s): e76d9f6
Files changed (2) hide show
  1. Dockerfile +4 -1
  2. ecosystem.config.js +16 -0
Dockerfile CHANGED
@@ -45,6 +45,9 @@ COPY --chown=user .env /app
45
 
46
  RUN ffmpeg -version
47
 
 
 
 
48
  # Copy the current directory contents into the container at /app setting the owner to the user
49
  COPY --chown=user . /app
50
 
@@ -54,4 +57,4 @@ EXPOSE 7860
54
 
55
  # we can't use this (it time out)
56
  # CMD [ "xvfb-run", "-s", "-ac -screen 0 1920x1080x24", "npm", "run", "start" ]
57
- CMD [ "npm", "run", "start" ]
 
45
 
46
  RUN ffmpeg -version
47
 
48
+ # To manage the Node process
49
+ RUN npm install pm2@latest -g
50
+
51
  # Copy the current directory contents into the container at /app setting the owner to the user
52
  COPY --chown=user . /app
53
 
 
57
 
58
  # we can't use this (it time out)
59
  # CMD [ "xvfb-run", "-s", "-ac -screen 0 1920x1080x24", "npm", "run", "start" ]
60
+ CMD [ "pm2-runtime", "ecosystem.config.js" ]
ecosystem.config.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ name: 'ai-tube-clap-exporter',
3
+
4
+ script: 'src/index.ts',
5
+ interpreter: 'node',
6
+ interpreter_args: '--import tsx',
7
+
8
+ // every 4 hours
9
+ // see https://freeformatter.com/cron-expression-generator-quartz.html
10
+ cron_restart: '0 0 */4 ? * *',
11
+
12
+ // exec_mode: 'cluster',
13
+ // instances: 1,
14
+
15
+ // other PM2 configuration options
16
+ }