mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
Merge pull request #63 from NiNiyas/docker-healthcheck
Docker Healthcheck
This commit is contained in:
commit
fb3e000dc3
2 changed files with 20 additions and 0 deletions
|
@ -31,6 +31,7 @@ RUN npm run build
|
|||
|
||||
EXPOSE 3001
|
||||
VOLUME ["/app/data"]
|
||||
HEALTHCHECK --interval=5s --timeout=3s --start-period=30s CMD node extra/healthcheck.js
|
||||
CMD ["npm", "run", "start-server"]
|
||||
|
||||
FROM release AS nightly
|
||||
|
|
19
extra/healthcheck.js
Normal file
19
extra/healthcheck.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
var http = require("http");
|
||||
var options = {
|
||||
host: "localhost",
|
||||
port: "3001",
|
||||
timeout: 2000,
|
||||
};
|
||||
var request = http.request(options, (res) => {
|
||||
console.log(`STATUS: ${res.statusCode}`);
|
||||
if (res.statusCode == 200) {
|
||||
process.exit(0);
|
||||
} else {
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
request.on("error", function (err) {
|
||||
console.log("ERROR");
|
||||
process.exit(1);
|
||||
});
|
||||
request.end();
|
Loading…
Reference in a new issue