mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-09-15 07:56:58 +08:00
Merge pull request #63 from NiNiyas/docker-healthcheck
Docker Healthcheck
This commit is contained in:
@@ -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();
|
Reference in New Issue
Block a user