2021-05-13 10:30:35 +00:00
|
|
|
FROM node:16.1.0-alpine
|
2020-07-30 12:23:49 +00:00
|
|
|
|
2021-05-25 14:12:04 +00:00
|
|
|
RUN apk update && apk add dnsmasq
|
|
|
|
|
2020-07-30 12:23:49 +00:00
|
|
|
WORKDIR /usr/app
|
|
|
|
|
2021-05-24 15:30:29 +00:00
|
|
|
# schedule critical checks to run every 5 minutes (any failures will disable server)
|
2021-05-24 15:13:29 +00:00
|
|
|
RUN echo '*/5 * * * * /usr/app/cli/run critical > /dev/stdout' >> /etc/crontabs/root
|
2021-05-24 15:30:29 +00:00
|
|
|
|
|
|
|
# schedule extended checks to run on every hour (optional checks, report only)
|
2021-05-24 15:13:29 +00:00
|
|
|
RUN echo '0 * * * * /usr/app/cli/run extended > /dev/stdout' >> /etc/crontabs/root
|
|
|
|
|
2020-07-30 12:23:49 +00:00
|
|
|
COPY package.json .
|
|
|
|
RUN yarn --no-lockfile
|
2020-09-09 14:08:10 +00:00
|
|
|
COPY src src
|
|
|
|
COPY cli cli
|
2020-07-30 12:23:49 +00:00
|
|
|
|
|
|
|
EXPOSE 3100
|
|
|
|
ENV NODE_ENV production
|
2021-05-24 15:30:29 +00:00
|
|
|
|
2021-06-22 12:22:17 +00:00
|
|
|
# 1. prepend dnsmasq nameserver so it tries to resolve first
|
|
|
|
# 2. start dnsmasq in the background and alias siasky.net with current server ip to ommit load balancer
|
|
|
|
# 3. start crond in the background
|
|
|
|
# 4. start the health-check api service
|
2021-05-25 14:12:04 +00:00
|
|
|
CMD [ "sh", "-c", \
|
2021-06-23 12:19:27 +00:00
|
|
|
"echo -e \"nameserver 127.0.0.1\noptions ndots:0\" > /etc/resolv.conf ; \
|
2021-06-23 12:23:28 +00:00
|
|
|
dnsmasq --server=127.0.0.11 --address=/siasky.net/$(node src/whatismyip.js) ; \
|
2021-05-25 14:12:04 +00:00
|
|
|
crond ; \
|
|
|
|
node --max-http-header-size=64000 src/index.js" \
|
|
|
|
]
|