From b666c98bcbd955f59c7ce2961e826c7912db9836 Mon Sep 17 00:00:00 2001 From: xubiaolin Date: Thu, 3 Jul 2025 11:55:29 +0800 Subject: [PATCH] add healthcheck --- Dockerfile | 10 +++++++--- docker-compose.yml | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 96414d4..2883907 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN set -x\ && cd ZeroTierOne\ && git checkout ${TAG}\ && echo "切换到tag:${TAG}"\ - && make ZT_SYMLINK=1 \ + && make ZT_SYMLINK=1 -j \ && make -j\ && make install\ && echo "make success!"\ @@ -44,7 +44,7 @@ RUN set -x\ RUN set -x \ && mkdir /app -p \ && 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 \ && npm config set registry https://registry.npmmirror.com\ && npm install -g node-gyp\ @@ -80,4 +80,8 @@ RUN set -x \ VOLUME [ "/app/dist","/app/ztncui","/var/lib/zerotier-one","/app/config"] -CMD ["/bin/sh","/app/entrypoint.sh"] \ No newline at end of file +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"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..bccc71c --- /dev/null +++ b/docker-compose.yml @@ -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