parent
caa641c550
commit
24e26be2e1
4 changed files with 31 additions and 0 deletions
11
.gitattributes
vendored
Normal file
11
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# behavior for Unix scripts
|
||||
#
|
||||
# Unix scripts are treated as binary by default.
|
||||
###############################################################################
|
||||
*.sh eol=lf
|
||||
|
|
@ -5,6 +5,7 @@ VOLUME /data
|
|||
WORKDIR /data
|
||||
EXPOSE 80
|
||||
ENTRYPOINT ["/bin/bash", "/usr/src/app/run.sh"]
|
||||
HEALTHCHECK CMD node /usr/src/app/src/healthcheck.js
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ EXPOSE 80
|
|||
VOLUME /data
|
||||
WORKDIR /data
|
||||
ENTRYPOINT ["node", "/usr/src/app/", "-p", "80"]
|
||||
HEALTHCHECK CMD node /usr/src/app/src/healthcheck.js
|
||||
|
||||
RUN mkdir -p /usr/src/app
|
||||
COPY / /usr/src/app
|
||||
|
|
|
|||
18
src/healthcheck.js
Normal file
18
src/healthcheck.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
var http = require("http");
|
||||
var options = {
|
||||
timeout: 2000,
|
||||
};
|
||||
var url = "http://localhost:80/health";
|
||||
var request = http.request(url, 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