diff --git a/Dockerfile.release b/Dockerfile.release index aa0d422cc..a676226a3 100644 --- a/Dockerfile.release +++ b/Dockerfile.release @@ -11,6 +11,8 @@ RUN curl -sSL -o zerotier-one.deb "${PACKAGE_BASEURL}/zerotier-one_${VERSION}_${ FROM debian:buster +RUN apt-get update -qq && apt-get install openssl libssl1.1 -y + COPY --from=stage zerotier-one.deb . RUN dpkg -i zerotier-one.deb && rm -f zerotier-one.deb @@ -20,5 +22,7 @@ RUN rm -rf /var/lib/zerotier-one COPY entrypoint.sh.release /entrypoint.sh RUN chmod 755 /entrypoint.sh +HEALTHCHECK --interval=1s CMD bash /healthcheck.sh + CMD [] ENTRYPOINT ["/entrypoint.sh"] diff --git a/entrypoint.sh.release b/entrypoint.sh.release index adc258194..0194d3658 100644 --- a/entrypoint.sh.release +++ b/entrypoint.sh.release @@ -1,7 +1,7 @@ #!/bin/sh grepzt() { - [ ! -n "$(cat /var/lib/zerotier-one/zerotier-one.pid)" -a -d "/proc/$(cat /var/lib/zerotier-one/zerotier-one.pid)" ] + [ -f /var/lib/zerotier-one/zerotier-one.pid -a -n "$(cat /var/lib/zerotier-one/zerotier-one.pid)" -a -d "/proc/$(cat /var/lib/zerotier-one/zerotier-one.pid)" ] return $? } @@ -40,26 +40,45 @@ killzerotier() { trap killzerotier INT TERM +echo "Configuring networks to join" +mkdir -p /var/lib/zerotier-one/networks.d + +echo "joining networks: $@" +for i in "$@" +do + echo "Configuring join for $i" + touch "/var/lib/zerotier-one/networks.d/${i}.conf" +done + echo "starting zerotier" nohup /usr/sbin/zerotier-one & while ! grepzt do echo "zerotier hasn't started, waiting a second" + + if [ -f nohup.out ] + then + tail -n 10 nohup.out + fi + sleep 1 done -echo "joining networks: $@" +echo "Writing healthcheck for networks: $@" -for i in "$@" +cat >/healthcheck.sh <