diff --git a/Dockerfile b/Dockerfile index d1c09e0..baa5613 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:lts-alpine +FROM node:lts-slim WORKDIR /app diff --git a/docker-compose.yml b/docker-compose.yml index 8176559..c0dbeea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,6 @@ services: env_file: - .env healthcheck: - test: ([ "$(wget -qO- ${PROXY_PUBLIC_URL}/healthcheck)" = "ok" ] && exit 0) || exit 1 + test: node /app/healthcheck.js interval: 120s start_period: 5s diff --git a/healthcheck.js b/healthcheck.js new file mode 100644 index 0000000..ce5e962 --- /dev/null +++ b/healthcheck.js @@ -0,0 +1,10 @@ +(async () => { + require('dotenv').config() + try { + const res = await fetch(process.env.PROXY_PUBLIC_URL + '/healthcheck') + if (await res.text() === 'ok') { + process.exit(0) + } + } catch (e) { } + process.exit(1) +})()