docker-zerotier-planet/Dockerfile

84 lines
2.4 KiB
Docker
Raw Normal View History

FROM alpine:3.14 as builder
ENV TZ=Asia/Shanghai
2024-02-23 11:16:08 -05:00
ARG TAG=main
ENV TAG=${TAG}
WORKDIR /app
2024-05-16 17:20:33 -04:00
ADD ./patch/entrypoint.sh /app/entrypoint.sh
ADD ./patch/http_server.js /app/http_server.js
ADD ./patch/mkworld_custom.cpp /app/patch/mkworld_custom.cpp
# init tool
RUN set -x\
2023-05-14 22:19:35 -04:00
&& apk update\
&& apk add --no-cache git python3 npm make g++ linux-headers curl pkgconfig openssl-dev jq build-base gcc \
&& echo "env prepare success!"
# make zerotier-one
RUN set -x\
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y\
&& source "$HOME/.cargo/env"\
&& git clone https://github.com/zerotier/ZeroTierOne.git\
&& cd ZeroTierOne\
2024-02-23 11:16:08 -05:00
&& git checkout ${TAG}\
&& echo "切换到tag:${TAG}"\
&& make ZT_SYMLINK=1 \
&& make\
&& make install\
&& echo "make success!"\
; zerotier-one -d \
; sleep 5s && ps -ef |grep zerotier-one |grep -v grep |awk '{print $1}' |xargs kill -9\
2024-05-16 17:20:33 -04:00
&& echo "zerotier-one init success!"\
&& cp /app/patch/mkworld_custom.cpp ./attic/world\
&& mv ./attic/world/mkworld.cpp ./attic/world/mkworld.cpp.bak \
&& mv ./attic/world/mkworld_custom.cpp ./attic/world/mkworld.cpp \
&& sh ./attic/world/build.sh \
&& mv ./attic/world/mkworld /var/lib/zerotier-one\
&& echo "mkworld build success!"
#make ztncui
RUN set -x \
&& mkdir /app -p \
&& cd /app \
2024-03-07 13:06:12 -05:00
&& git clone --progress https://ghproxy.imoyuapp.win/https://github.com/key-networks/ztncui.git\
2023-05-14 22:19:35 -04:00
&& cd /app/ztncui/src \
&& npm config set registry https://registry.npmmirror.com\
&& npm install -g node-gyp\
&& npm install
FROM alpine:3.14
WORKDIR /app
ENV IP_ADDR4=''
ENV IP_ADDR6=''
ENV ZT_PORT=9994
ENV API_PORT=3443
ENV FILE_SERVER_PORT=3000
2024-05-16 17:20:33 -04:00
ENV GH_MIRROR="https://mirror.ghproxy.com/"
ENV FILE_KEY=''
ENV TZ=Asia/Shanghai
COPY --from=builder /app/ztncui /bak/ztncui
COPY --from=builder /var/lib/zerotier-one /bak/zerotier-one
COPY --from=builder /app/ZeroTierOne/zerotier-one /usr/sbin/zerotier-one
COPY --from=builder /app/entrypoint.sh /app/entrypoint.sh
COPY --from=builder /app/http_server.js /app/http_server.js
2024-05-16 17:20:33 -04:00
COPY --from=builder /app/ZeroTierOne/attic/world/mkworld /var/lib/zerotier-one/mkworld
2024-05-16 17:20:33 -04:00
RUN set -x \
&& apk update \
2024-01-06 08:07:05 -05:00
&& apk add --no-cache npm curl jq openssl\
&& mkdir /app/config -p
VOLUME [ "/app/dist","/app/ztncui","/var/lib/zerotier-one","/app/config"]
CMD ["/bin/sh","/app/entrypoint.sh"]