Skip to content

Commit

Permalink
Added support docker healthcheck (#42)
Browse files Browse the repository at this point in the history
* added docker health check support
  • Loading branch information
BernardTolosajr authored and xudafeng committed Apr 18, 2018
1 parent 0f4fec8 commit 1f10e0d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@ RUN npm config set unsafe-perm=true
RUN npm i -g macaca-datahub

COPY ./entrypoint.sh /entrypoint.sh
COPY ./healthcheck.js /healthcheck.js

# Only run npm install if these files change.
ADD ./package.json /package.json

RUN npm install

HEALTHCHECK CMD node /healthcheck.js || exit 1

ENTRYPOINT ["/entrypoint.sh"]
9 changes: 9 additions & 0 deletions healthcheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

const request = require('request');

request('http://0.0.0.0:9200', error => {
if (error) {
throw error;
}
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"macaca-logo": "^1.0.0",
"mz": "^2.7.0",
"npm-update": "^1.0.6",
"request": "^2.85.0",
"semver": "^5.5.0",
"socket.io": "^2.0.4",
"sqlite3": "^3.1.13",
Expand Down

0 comments on commit 1f10e0d

Please sign in to comment.