add readme

This commit is contained in:
xubiaolin
2021-11-21 16:53:20 +08:00
parent d48a353444
commit dc4e598be9
14 changed files with 113 additions and 88 deletions

View File

@@ -1,54 +1,39 @@
FROM centos:7
FROM alpine:latest
WORKDIR /var/lib/zerotier-one/
COPY . /var/lib/zerotier-one/
VOLUME ["/opt","/var/lib/zerotier-one"]
EXPOSE 9993
ADD ./run.sh /app/
ADD ./patch /opt/patch/
RUN curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo && \
yum update -y && \
yum install git make gcc gcc-c++ python3 wget -y && \
yum install centos-release-scl -y &&\
yum install devtoolset-8 -y &&\
VOLUME ["/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 git python3 nodejs npm make g++ linux-headers zerotier-one &&\
npm config set registry http://registry.npm.taobao.org &&\
# 安装ztncui
cd /opt && git clone https://github.com.cnpmjs.org/key-networks/ztncui.git &&\
cd ztncui/src && npm install -g node-gyp && npm install &&\
echo 'HTTP_PORT=3443' > .env&&\
echo 'NODE_ENV=production' >> .env &&\
echo 'HTTP_ALL_INTERFACES=true' >> .env &&\
# 添加补丁
cd /opt && \
git clone https://github.com.cnpmjs.org/zerotier/ZeroTierOne.git && \
cd ZeroTierOne && \
make && \
make install && \
# 配置moon
cd /var/lib/zerotier-one && \
zerotier-idtool generate identity.public identity.secret &&\
zerotier-idtool initmoon identity.public >> moon.json &&\
#配置ztncui
cd /opt &&\
curl -sL https://rpm.nodesource.com/setup_10.x | bash - &&\
yum install nodejs -y &&\
rm -rf ztncui/ &&\
git clone https://github.com.cnpmjs.org/key-networks/ztncui.git &&\
cd ztncui/src &&\
npm install -g node-gyp &&\
npm install &&\
sh -c "echo 'HTTP_PORT=3443' > .env"&&\
sh -c "echo 'NODE_ENV=production' >> .env"&&\
# 配置补丁
cd /var/lib/zerotier-one && \
python3 patch.py && \
zerotier-idtool genmoon moon.json && \
mkdir moons.d && cp ./*.moon ./moons.d &&\
rm -rf planet &&\
# 编译新的plane
cp /opt/patch/* . &&\
python3 patch.py &&\
rm /opt/ZeroTierOne/attic/world/mkworld.cpp &&\
cp mkworld.cpp /opt/ZeroTierOne/attic/world/ &&\
cd /opt/ZeroTierOne/attic/world/ && \
sh build.sh &&\
mv world.bin /var/lib/zerotier-one/planet
CMD [ "bash","run.sh" ]
cp ./world.bin /var/lib/zerotier-one/planet
WORKDIR /app/
CMD ["sh","./run.sh"]