Skip to content

Commit d759b40

Browse files
committed
initial dockerfile
1 parent 5872962 commit d759b40

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.md
2+
node_modules/

Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node
2+
3+
COPY package.json /usr/local/src/package.json
4+
WORKDIR /usr/local/src
5+
6+
RUN npm install
7+
8+
ADD . /usr/local/src
9+
10+
EXPOSE 8085
11+
12+
CMD ["npm", "start"]

config.js

+4
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ var config = require('config-node');
33
config({env: 'default'});
44
config();
55

6+
if (!!process.env.ZOOKEEPER_CONNECT) {
7+
config.kafka.zkConnect = process.env.ZOOKEEPER_CONNECT;
8+
}
9+
610
module.exports = config;

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
"morgan": "^1.6.1",
1414
"murmurhash-js": "^1.0.0",
1515
"promise": "^7.0.4",
16-
"socket.io": "^1.3.7",
1716
"uuid": "^2.0.1"
1817
},
1918
"devDependencies": {
2019
"request": "^2.67.0",
2120
"request-promise": "^1.0.2",
2221
"yargs": "^3.31.0"
22+
},
23+
"scripts": {
24+
"start": "node server.js"
2325
}
2426
}

server.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ var express = require('express'),
99
morgan = require('morgan'),
1010
accessLogStream = fs.createWriteStream(__dirname + '/' + config.accessLogPath, {flags: 'a'});
1111

12+
logger.info('Starting application...');
13+
1214
app.use(morgan('combined', { stream: accessLogStream }));
1315

1416
app.use(function(req, res, next) {
@@ -37,4 +39,6 @@ app.use(function errorHandler(err, req, res, next) {
3739
res.status(500).json({ 'error_code': 500, 'message': err });
3840
});
3941

40-
app.listen(config.port);
42+
app.listen(config.port, function () {
43+
logger.info('Application listening on port ' + config.port);
44+
});

0 commit comments

Comments
 (0)