From 5acd01ad809701c69eb9828e01b210efab090fff Mon Sep 17 00:00:00 2001 From: xubiaolin Date: Mon, 15 May 2023 10:14:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8A=A0=E9=80=9F=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 52 ++++++++++++++++++++++------------------------------ 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6283cd4..ca60db1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,33 +7,26 @@ ENV TZ=Asia/Shanghai WORKDIR /app ADD . /app -RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \ - && apk update\ - && mkdir -p /usr/include/nlohmann/ && cd /usr/include/nlohmann/ && wget https://ghproxy.markxu.online/https://github.com/nlohmann/json/releases/download/v3.10.5/json.hpp \ - && apk add --no-cache git python3 npm make g++ zerotier-one \ - && npm install -g node-gyp\ - && mkdir /app -p && cd /app && git clone https://ghproxy.markxu.online/https://github.com/key-networks/ztncui.git\ - && cd /app/ztncui/src \ - && cp /app/patch/binding.gyp .\ - && npm install \ - && echo 'HTTP_PORT=3443' >.env \ - && echo 'NODE_ENV=production' >>.env \ - && echo 'HTTP_ALL_INTERFACES=true' >>.env \ - && echo "ZT_ADDR=localhost:${ZT_PORT}" >>.env\ - && echo "${ZT_PORT}" >/app/zerotier-one.port \ - && cp -v etc/default.passwd etc/passwd +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && + apk update && mkdir -p /usr/include/nlohmann/ && cd /usr/include/nlohmann/ && wget https://ghself.markxu.online/https://github.com/nlohmann/json/releases/download/v3.10.5/json.hpp && + apk add --no-cache git python3 npm make g++ zerotier-one && + npm install -g node-gyp && mkdir /app -p && cd /app && git clone https://ghself.markxu.online/https://github.com/key-networks/ztncui.git && cd /app/ztncui/src && + cp /app/patch/binding.gyp . && npm install && + echo 'HTTP_PORT=3443' >.env && + echo 'NODE_ENV=production' >>.env && + echo 'HTTP_ALL_INTERFACES=true' >>.env && + echo "ZT_ADDR=localhost:${ZT_PORT}" >>.env && echo "${ZT_PORT}" >/app/zerotier-one.port && + cp -v etc/default.passwd etc/passwd -RUN cd /app && git clone -v https://ghproxy.markxu.online/https://github.com/zerotier/ZeroTierOne.git --depth 1\ - && zerotier-one -d && sleep 5s && ps -ef |grep zerotier-one |grep -v grep |awk '{print $1}' |xargs kill -9 \ - && cd /var/lib/zerotier-one && zerotier-idtool initmoon identity.public >moon.json\ - && cd /app/patch && python3 patch.py \ - && cd /var/lib/zerotier-one && zerotier-idtool genmoon moon.json && mkdir moons.d && cp ./*.moon ./moons.d \ - && cd /app/ZeroTierOne/attic/world/ && sh build.sh \ - && sleep 5s \ - && cd /app/ZeroTierOne/attic/world/ && ./mkworld \ - && mkdir /app/bin -p && cp world.bin /app/bin/planet \ - && TOKEN=$(cat /var/lib/zerotier-one/authtoken.secret) \ - && echo "ZT_TOKEN=$TOKEN">> /app/ztncui/src/.env +RUN cd /app && git clone -v https://ghself.markxu.online/https://github.com/zerotier/ZeroTierOne.git --depth 1 && zerotier-one -d && sleep 5s && ps -ef | grep zerotier-one | grep -v grep | awk '{print $1}' | xargs kill -9 && + cd /var/lib/zerotier-one && zerotier-idtool initmoon identity.public >moon.json && cd /app/patch && python3 patch.py && + cd /var/lib/zerotier-one && zerotier-idtool genmoon moon.json && mkdir moons.d && cp ./*.moon ./moons.d && + cd /app/ZeroTierOne/attic/world/ && sh build.sh && + sleep 5s && + cd /app/ZeroTierOne/attic/world/ && ./mkworld && + mkdir /app/bin -p && cp world.bin /app/bin/planet && + TOKEN=$(cat /var/lib/zerotier-one/authtoken.secret) && + echo "ZT_TOKEN=$TOKEN" >>/app/ztncui/src/.env FROM alpine:3.17 WORKDIR /app @@ -43,10 +36,9 @@ COPY --from=builder /app/bin /app/bin COPY --from=builder /app/zerotier-one.port /app/zerotier-one.port COPY --from=builder /var/lib/zerotier-one /var/lib/zerotier-one -RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \ - && apk update\ - && apk add --no-cache npm zerotier-one +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && + apk update && apk add --no-cache npm zerotier-one VOLUME [ "/app","/var/lib/zerotier-one" ] -CMD /bin/sh -c "cd /var/lib/zerotier-one && ./zerotier-one -p`cat /app/zerotier-one.port` -d; cd /app/ztncui/src;npm start" +CMD /bin/sh -c "cd /var/lib/zerotier-one && ./zerotier-one -p$(cat /app/zerotier-one.port) -d; cd /app/ztncui/src;npm start"