编译 ntop/n2n

git 导入 ntop/n2n 源码,编译生成 n2n 的 edge,supernode 可执行文件
https://github.com/ntop/n2n.git

git clone https://github.com/ntop/n2n.git -b 2.6-stable ntop-n2n
cd ntop-n2n
./autogen.sh  # 自动配置 Makefile
make

生成可执行文件:

  • edge
  • supernode

配置文件:

  • ./packages/etc/n2n/edge.conf.sample
  • ./packages/etc/n2n/supernode.conf.sample

Dockerfile

目录文件:

# docker build --force-rm n2n-supernode -t ntp/n2n-supernode:v2.6.1
FROM debian:latest

MAINTAINER Minh-Quan TRAN "xwiron@aliyun.com"

COPY edge.conf.sample /etc/n2n/edge.conf
COPY supernode.conf.sample /etc/n2n/supernode.conf
COPY supernodes.list.sample /etc/n2n/supernodes.list

COPY edge /usr/sbin/edge
COPY supernode /usr/sbin/supernode

RUN chmod +x /usr/sbin/edge
RUN chmod +x /usr/sbin/supernode

COPY libc6-udeb_2.28-10_amd64.udeb libc6-udeb_2.28-10_amd64.udeb
COPY libcrypto1.1-udeb_1.1.1d-0+deb10u3_amd64.udeb libcrypto1.1-udeb_1.1.1d-0+deb10u3_amd64.udeb

RUN dpkg -i libc6-udeb_2.28-10_amd64.udeb
RUN dpkg -i libcrypto1.1-udeb_1.1.1d-0+deb10u3_amd64.udeb

RUN rm libc6-udeb_2.28-10_amd64.udeb
RUN rm libcrypto1.1-udeb_1.1.1d-0+deb10u3_amd64.udeb

RUN useradd n2n -s /sbin/nologin

# main listen 0.0.0.0:5556
EXPOSE 5643

# management listen 127.0.0.1:5645
# EXPOSE 5645

# USER
USER n2n

# COMMAND
CMD ["/usr/sbin/supernode", "/etc/n2n/supernode.conf"]

docker run image

从 git 导出文件,可能会失去可执行属性。
chomod +x edge supernode

docker run --restart=always \
    --name n2n-supernode-v2.6\
    -p <port>:5643/udp \
    -v /[host-path]/config:/etc/n2n \
    -d ntop/n2n-supernode:v2.6

标签: none

添加新评论