master
cn.yimian.xyz 4 years ago
parent d81f4fb53e
commit 0ce1fc1d2d
  1. 16
      Dockerfile
  2. 11
      pm2.json
  3. 4
      src/index.js
  4. 0
      src/startup.sh

@ -0,0 +1,16 @@
FROM keymetrics/pm2:latest-alpine
# Bundle APP files
COPY src src/
COPY package.json .
COPY pm2.json .
# Install app dependencies
ENV NPM_CONFIG_LOGLEVEL warn
RUN npm install --production
RUN pm2 install pm2-auto-pull
# Show current folder structure in logs
RUN ls -al -R
CMD [ "pm2-runtime", "start", "pm2.json" ]

@ -0,0 +1,11 @@
{
"name": "acg.watch-api",
"script": "src/index.js",
"instances": "2",
"env": {
"NODE_ENV": "development"
},
"env_production" : {
"NODE_ENV": "production"
}
}

@ -57,7 +57,7 @@ var video = {
danmakuID: '40404040',
'class': 'extra'
},
getAll: () => JSON.parse(fs.readFileSync(__dirname+'/../cache/video.json')),
getAll: () => JSON.parse(fs.readFileSync('mnt/cache/video/video.json')),
getClassBySeries: series => new Promise((resolve, reject) => {
Object.keys(video.obj).forEach(item => {
if(video.obj[item].hasOwnProperty(series)){
@ -109,5 +109,5 @@ var video = {
/* watch video.json cache */
video.reload();
fs.watch(__dirname+'/../cache/', event => video.reload());
fs.watch('/mnt/cache/video/', event => video.reload());
Loading…
Cancel
Save