docker-zerotier-planet/Dockerfile

44 lines
2.7 KiB
Docker
Raw Normal View History

FROM ubuntu:20.04
ENV TZ=Asia/Shanghai \
DEBIAN_FRONTEND=noninteractive
2022-02-20 07:25:08 -05:00
2022-05-14 10:57:17 -04:00
ADD . /app
2022-02-20 07:25:08 -05:00
2022-08-21 22:54:30 -04:00
RUN echo "deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse" > /etc/apt/sources.list \
&& echo "deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse" >>/etc/apt/sources.list \
&& echo "deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse" >>/etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse" >>/etc/apt/sources.list \
&& echo "deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse" >>/etc/apt/sources.list \
&& echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse" >>/etc/apt/sources.list \
2022-08-21 22:43:23 -04:00
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' > /etc/timezone\
2022-08-21 22:47:05 -04:00
&& apt update && apt install git python3 npm make curl wget -y \
2022-08-21 22:43:23 -04:00
&& mkdir /usr/include/nlohmann/ && cd /usr/include/nlohmann/ && wget https://github.com/nlohmann/json/releases/download/v3.10.5/json.hpp \
&& npm config set registry http://registry.npm.taobao.org && npm install -g node-gyp \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
2022-02-20 07:25:08 -05:00
2022-08-19 07:53:52 -04:00
RUN curl -s https://install.zerotier.com | bash \
2022-10-11 05:08:37 -04:00
&& cd /opt && git clone -v https://ghproxy.com/https://github.com/key-networks/ztncui.git --depth 1 \
&& cd /opt && git clone -v https://ghproxy.com/https://github.com/zerotier/ZeroTierOne.git --depth 1 \
2022-08-19 07:53:52 -04:00
&& cd /opt/ztncui/src \
&& npm install \
&& cp -pv ./etc/default.passwd ./etc/passwd \
&& echo 'HTTP_PORT=3443' >.env \
&& echo 'NODE_ENV=production' >>.env \
&& echo 'HTTP_ALL_INTERFACES=true' >>.env
RUN 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 /opt/ZeroTierOne/attic/world/ && sh build.sh \
&& sleep 5s \
&& cd /opt/ZeroTierOne/attic/world/ && ./mkworld \
&& mkdir /app/bin -p && cp world.bin /app/bin/planet \
&& service zerotier-one restart
2022-08-19 08:02:01 -04:00
2022-02-20 07:25:08 -05:00
WORKDIR /app/
CMD /bin/sh -c "zerotier-one -d; cd /opt/ztncui/src;npm start"