add healthcheck with netcap checking port

This commit is contained in:
edgd1er 2021-10-26 22:56:47 +02:00
parent 5f7ef1397f
commit a564822e26
4 changed files with 29 additions and 9 deletions

8
.dockerignore Normal file
View file

@ -0,0 +1,8 @@
log/
.idea
.github
*.db
*.yml
*.md
*.sh
Makefile

5
.gitignore vendored
View file

@ -129,4 +129,7 @@ dmypy.json
.pyre/ .pyre/
# Helm # Helm
charts/*/*.tgz charts/*/*.tgz
/.idea/
docker-compose-*.yml
*.sh

View file

@ -24,12 +24,17 @@ RUN apk add --no-cache --update \
python3-tkinter \ python3-tkinter \
sqlite-libs \ sqlite-libs \
py3-pip \ py3-pip \
tzdata \ tzdata \
netcat-openbsd \
build-base python3-dev && \ build-base python3-dev && \
pip3 install --no-cache peewee tzlocal pytz wheel && \ pip3 install --no-cache peewee tzlocal pytz wheel && \
apk del git build-base python3-dev && \ apk del git build-base python3-dev && \
&& addgroup power_users \
&& adduser -S py-kms -G users -s /bin/bash \
&& usermod -a -G power_users py-kms \
&& chown py-kms:users /home/py-kms \
# Fix undefined timezone, in case the user did not mount the /etc/localtime # Fix undefined timezone, in case the user did not mount the /etc/localtime
ln -sf /usr/share/zoneinfo/UTC /etc/localtime && ln -sf /usr/share/zoneinfo/UTC /etc/localtime
WORKDIR /home/py-kms WORKDIR /home/py-kms
@ -37,5 +42,7 @@ EXPOSE ${PORT}/tcp
COPY docker/entrypoint.py /usr/bin/entrypoint.py COPY docker/entrypoint.py /usr/bin/entrypoint.py
RUN chmod a+x /usr/bin/entrypoint.py RUN chmod a+x /usr/bin/entrypoint.py
ENTRYPOINT ["/usr/bin/python3", "/usr/bin/entrypoint.py"] HEALTHCHECK --interval=5m --timeout=3s --start-period=10s --retries=4 CMD echo | nc -t localhost ${PORT} || exit 1
#CMD["/usr/bin/start.py"]
ENTRYPOINT ["/usr/bin/python3", "-u","/usr/bin/entrypoint.py"]
CMD["/usr/bin/start.py"]

View file

@ -16,8 +16,7 @@ ENV LOGFILE STDOUT
ENV LOGSIZE "" ENV LOGSIZE ""
ENV TZ America/Chicago ENV TZ America/Chicago
COPY ./py-kms /home/py-kms COPY py-kms /home/py-kms/
#hadolint ignore=DL3013,DL3018 #hadolint ignore=DL3013,DL3018
RUN apk add --no-cache --update \ RUN apk add --no-cache --update \
bash \ bash \
@ -34,6 +33,7 @@ RUN apk add --no-cache --update \
duplicity \ duplicity \
tzdata \ tzdata \
shadow \ shadow \
netcat-openbsd \
&& git clone --branch master --depth 1 https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web \ && git clone --branch master --depth 1 https://github.com/coleifer/sqlite-web.git /tmp/sqlite_web \
&& mv /tmp/sqlite_web/sqlite_web /home/ \ && mv /tmp/sqlite_web/sqlite_web /home/ \
&& rm -rf /tmp/sqlite_web \ && rm -rf /tmp/sqlite_web \
@ -54,8 +54,10 @@ RUN chmod 755 /usr/bin/entrypoint.py
WORKDIR /home/py-kms WORKDIR /home/py-kms
#USER py-kms #USER py-kms
EXPOSE 1688/tcp EXPOSE ${PORT}/tcp
EXPOSE 8080 EXPOSE 8080
ENTRYPOINT [ "/usr/bin/python3", "/usr/bin/entrypoint.py" ] HEALTHCHECK --interval=5m --timeout=3s --start-period=10s --retries=4 CMD echo | nc -t localhost ${PORT} || exit 1
ENTRYPOINT [ "/usr/bin/python3","-u","/usr/bin/entrypoint.py" ]
CMD ["/usr/bin/start.py"] CMD ["/usr/bin/start.py"]