Created docker file
This commit is contained in:
parent
882a088d84
commit
636a02d04d
5
.dockerignore
Normal file
5
.dockerignore
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Created by .ignore support plugin (hsz.mobi)
|
||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
|
||||||
|
|
19
Dockerfile
Normal file
19
Dockerfile
Normal 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" ]
|
@ -11,7 +11,7 @@ const http = require('http');
|
|||||||
const https = require('https');
|
const https = require('https');
|
||||||
const apicache = require('apicache');
|
const apicache = require('apicache');
|
||||||
|
|
||||||
const port = process.env.PORT || 6566;
|
const port = process.env.PORT || 8080;
|
||||||
|
|
||||||
logger.level = 'debug';
|
logger.level = 'debug';
|
||||||
|
|
||||||
@ -106,8 +106,6 @@ function getUrl (req, res) {
|
|||||||
http.request(options, responseHandler).end();
|
http.request(options, responseHandler).end();
|
||||||
|
|
||||||
function responseHandler(response) {
|
function responseHandler(response) {
|
||||||
console.log(`STATUS: ${response.statusCode}`);
|
|
||||||
console.log(`HEADERS: ${JSON.stringify(response.headers)}`);
|
|
||||||
response.setEncoding('utf8');
|
response.setEncoding('utf8');
|
||||||
if (response.statusCode === 302 || response.statusCode === 301) {
|
if (response.statusCode === 302 || response.statusCode === 301) {
|
||||||
body = [];
|
body = [];
|
||||||
@ -119,7 +117,7 @@ function getUrl (req, res) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
logger.debug('>> follow', response.headers.location, count);
|
logger.debug('>> follow', response.headers.location, count);
|
||||||
// logger.debug(rUrl);
|
|
||||||
count++;
|
count++;
|
||||||
if (rUrl.protocol === 'https:')
|
if (rUrl.protocol === 'https:')
|
||||||
https.request(rUrl, responseHandler).end();
|
https.request(rUrl, responseHandler).end();
|
||||||
|
Loading…
Reference in New Issue
Block a user