From e21a67f6a1530e8f49bac801fe2e6bd498c95bc1 Mon Sep 17 00:00:00 2001 From: "cn.yimian.xyz" Date: Fri, 19 Jun 2020 16:00:50 +0800 Subject: [PATCH] docker --- Dockerfile | 16 ++++++++++++++++ pm2.json | 12 ++++++++++++ update.js => src/update.js | 0 3 files changed, 28 insertions(+) create mode 100644 Dockerfile create mode 100644 pm2.json rename update.js => src/update.js (100%) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a3c33ac --- /dev/null +++ b/Dockerfile @@ -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" ] diff --git a/pm2.json b/pm2.json new file mode 100644 index 0000000..4d1e6cb --- /dev/null +++ b/pm2.json @@ -0,0 +1,12 @@ +{ + "name": "bingImgUpdate-opt", + "script": "src/update.js", + "restart_delay": 43200000, + "instances": "2", + "env": { + "NODE_ENV": "development" + }, + "env_production" : { + "NODE_ENV": "production" + } +} diff --git a/update.js b/src/update.js similarity index 100% rename from update.js rename to src/update.js