修改为Alpine镜像 (#53)

* feat: 🎸 修改部署方式

* feat: 🎸 修改目录

* feat: 🎸 修改文案

* feat: 🎸 修改目录

* feat: 🎸 change mirror

* feat: 🎸 add ignore

* feat: 🎸 增加导出配置的接口

* feat: 🎸 增加导入和导出

* feat: 🎸 mod deploy

* feat: 🎸 del st

* feat: 🎸 使用全局便俩个

* feat: 🎸 增加导入

* 修改ignore

* feat: 🎸 修复打包权限的问题,处理path的我替你

* feat: 🎸 修改文案

* feat: 🎸 名字改下

* feat: 🎸 修改名字

* feat: 🎸 暴漏端口

* feat: 🎸 删除一段代码

* feat: 🎸 use apline

* feat: 🎸 fix path

* feat: 🎸 add json.hpp

* feat: 🎸 mkdir

* feat: 🎸 add mirros

* feat: 🎸 add binding.gyp

* feat: 🎸 update readme

---------

Co-authored-by: xubiaolin <xubiaolin2014@xiaochuankeji.cn>
Co-authored-by: prod <prod@markxu.vip>
This commit is contained in:
Markxu
2023-02-23 14:06:01 +08:00
committed by GitHub
parent 3a9885fcb8
commit d5cd1505da
6 changed files with 53 additions and 52 deletions

View File

@@ -1,43 +1,35 @@
FROM ubuntu:20.04
ENV TZ=Asia/Shanghai \
DEBIAN_FRONTEND=noninteractive
ADD . /app
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 \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' > /etc/timezone\
&& apt update && apt install git python3 npm make curl wget -y \
&& 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/*
RUN curl -s https://install.zerotier.com | bash \
&& 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 \
&& 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
WORKDIR /app/
CMD /bin/sh -c "zerotier-one -d; cd /opt/ztncui/src;npm start"
FROM alpine:latest
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.com/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.com/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 \
&& cp -v etc/default.passwd etc/passwd
RUN cd /app && git clone -v https://ghproxy.com/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
CMD /bin/sh -c "zerotier-one -d; cd /app/ztncui/src;npm start"