add healthcheck

This commit is contained in:
xubiaolin
2025-07-03 11:55:29 +08:00
parent bb8c9f6a2d
commit b666c98bcb
2 changed files with 28 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ RUN set -x\
&& cd ZeroTierOne\ && cd ZeroTierOne\
&& git checkout ${TAG}\ && git checkout ${TAG}\
&& echo "切换到tag:${TAG}"\ && echo "切换到tag:${TAG}"\
&& make ZT_SYMLINK=1 \ && make ZT_SYMLINK=1 -j \
&& make -j\ && make -j\
&& make install\ && make install\
&& echo "make success!"\ && echo "make success!"\
@@ -44,7 +44,7 @@ RUN set -x\
RUN set -x \ RUN set -x \
&& mkdir /app -p \ && mkdir /app -p \
&& cd /app \ && cd /app \
&& git clone --progress https://ghproxy.imoyuapp.win/https://github.com/key-networks/ztncui.git\ && git clone --progress https://github.com/key-networks/ztncui.git\
&& cd /app/ztncui/src \ && cd /app/ztncui/src \
&& npm config set registry https://registry.npmmirror.com\ && npm config set registry https://registry.npmmirror.com\
&& npm install -g node-gyp\ && npm install -g node-gyp\
@@ -80,4 +80,8 @@ RUN set -x \
VOLUME [ "/app/dist","/app/ztncui","/var/lib/zerotier-one","/app/config"] VOLUME [ "/app/dist","/app/ztncui","/var/lib/zerotier-one","/app/config"]
CMD ["/bin/sh","/app/entrypoint.sh"] HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD sh -c "nc -z localhost ${ZT_PORT:-9994}" || exit 1
CMD ["/bin/sh","/app/entrypoint.sh"]

21
docker-compose.yml Normal file
View File

@@ -0,0 +1,21 @@
services:
myztplanet:
image: xubiaolin/zerotier-planet:latest
container_name: ztplanet
ports:
- 9994:9994
- 9994:9994/udp
- 3443:3443
- 3000:3000
environment:
- IP_ADDR4=192.168.100.101
- IP_ADDR6=
- ZT_PORT=9994
- API_PORT=3443
- FILE_SERVER_PORT=3000
volumes:
- ./data/zerotier/dist:/app/dist
- ./data/zerotier/ztncui:/app/ztncui
- ./data/zerotier/one:/var/lib/zerotier-one
- ./data/zerotier/config:/app/config
restart: unless-stopped