From 7404736202cc6e7d9e37408f1d42dd4113310872 Mon Sep 17 00:00:00 2001 From: "usa.yimian.xyz" Date: Sun, 14 Mar 2021 09:01:06 -0400 Subject: [PATCH] docker --- Dockerfile | 15 +++++++++++++++ pm2.json | 12 ++++++++++++ framework.html => src/framework.html | 0 index.html => src/index.html | 0 index.js => src/index.js | 4 ++-- 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 Dockerfile create mode 100644 pm2.json rename framework.html => src/framework.html (100%) rename index.html => src/index.html (100%) rename index.js => src/index.js (99%) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..43f5b69 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +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 + +# 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..0d17590 --- /dev/null +++ b/pm2.json @@ -0,0 +1,12 @@ +{ + "name": "wIoT-webpage", + "script": "src/index.js", + "restart_delay": 43200000, + "instances": "2", + "env": { + "NODE_ENV": "development" + }, + "env_production" : { + "NODE_ENV": "production" + } +} diff --git a/framework.html b/src/framework.html similarity index 100% rename from framework.html rename to src/framework.html diff --git a/index.html b/src/index.html similarity index 100% rename from index.html rename to src/index.html diff --git a/index.js b/src/index.js similarity index 99% rename from index.js rename to src/index.js index ab77757..5493ff3 100644 --- a/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -const PORT = 4002; +const PORT = 80; const KEY = 'abcde'; const PATH_LENGTH = 4; @@ -133,4 +133,4 @@ let render = function(template, data){ }); return s; -} \ No newline at end of file +}