Created docker file

This commit is contained in:
Martin Donnelly 2018-01-23 17:00:29 +00:00
parent 882a088d84
commit 636a02d04d
3 changed files with 26 additions and 4 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
# Created by .ignore support plugin (hsz.mobi)
node_modules
npm-debug.log

19
Dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM node:carbon
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
# If you are building your code for production
# RUN npm install --only=production
# Bundle app source
COPY . .
EXPOSE 8080
CMD [ "npm", "start" ]

View File

@ -11,7 +11,7 @@ const http = require('http');
const https = require('https');
const apicache = require('apicache');
const port = process.env.PORT || 6566;
const port = process.env.PORT || 8080;
logger.level = 'debug';
@ -106,8 +106,6 @@ function getUrl (req, res) {
http.request(options, responseHandler).end();
function responseHandler(response) {
console.log(`STATUS: ${response.statusCode}`);
console.log(`HEADERS: ${JSON.stringify(response.headers)}`);
response.setEncoding('utf8');
if (response.statusCode === 302 || response.statusCode === 301) {
body = [];
@ -119,7 +117,7 @@ function getUrl (req, res) {
};
logger.debug('>> follow', response.headers.location, count);
// logger.debug(rUrl);
count++;
if (rUrl.protocol === 'https:')
https.request(rUrl, responseHandler).end();