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..bdb0c41 --- /dev/null +++ b/pm2.json @@ -0,0 +1,11 @@ +{ + "name": "ushio-session", + "script": "src/app.js", + "instances": "2", + "env": { + "NODE_ENV": "development" + }, + "env_production" : { + "NODE_ENV": "production" + } +} diff --git a/app.js b/src/app.js similarity index 100% rename from app.js rename to src/app.js diff --git a/bin/www b/src/bin/www similarity index 100% rename from bin/www rename to src/bin/www diff --git a/public/stylesheets/style.css b/src/public/stylesheets/style.css similarity index 100% rename from public/stylesheets/style.css rename to src/public/stylesheets/style.css diff --git a/routes/index.js b/src/routes/index.js similarity index 98% rename from routes/index.js rename to src/routes/index.js index 75c3bb7..ca1729f 100644 --- a/routes/index.js +++ b/src/routes/index.js @@ -5,7 +5,9 @@ var redis = require('redis'); /* redis start */ -var rc = new redis.createClient(); +var rc = new redis.createClient({ + host: 'redis' +}); router.get('/set', function(req, res, next) { res.header('Access-Control-Allow-Origin', '*'); diff --git a/routes/users.js b/src/routes/users.js similarity index 100% rename from routes/users.js rename to src/routes/users.js diff --git a/views/error.pug b/src/views/error.pug similarity index 100% rename from views/error.pug rename to src/views/error.pug diff --git a/views/index.pug b/src/views/index.pug similarity index 100% rename from views/index.pug rename to src/views/index.pug diff --git a/views/layout.pug b/src/views/layout.pug similarity index 100% rename from views/layout.pug rename to src/views/layout.pug