├── .dockerignore ├── .gitignore ├── image-platforms ├── common │ ├── dependencies.pkglist │ └── prepare-build.sh ├── Dockerfile.x86_64 ├── Dockerfile.arm32v7 └── Dockerfile.arm64v8 ├── LICENSE ├── README.md └── Makefile /.dockerignore: -------------------------------------------------------------------------------- 1 | build -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | n2n -------------------------------------------------------------------------------- /image-platforms/common/dependencies.pkglist: -------------------------------------------------------------------------------- 1 | gcc 2 | libc6-dev 3 | libssl-dev 4 | ca-certificates 5 | git 6 | make -------------------------------------------------------------------------------- /image-platforms/common/prepare-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! "$COMMIT_HASH" = "" ]; then 4 | echo "Using COMMIT_HASH=$COMMIT_HASH" 5 | git reset --hard $COMMIT_HASH 6 | fi 7 | 8 | make -------------------------------------------------------------------------------- /image-platforms/Dockerfile.x86_64: -------------------------------------------------------------------------------- 1 | FROM debian:stretch AS builder 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | 5 | COPY ./image-platforms/common/dependencies.pkglist /tmp 6 | 7 | RUN apt-get update \ 8 | && cat tmp/dependencies.pkglist | xargs apt-get install -y --no-install-recommends \ 9 | && rm -rf /var/lib/apt/lists/* 10 | 11 | ARG COMMIT_HASH 12 | 13 | COPY ./ /usr/src/n2n 14 | 15 | WORKDIR /usr/src/n2n 16 | 17 | RUN chmod +x image-platforms/common/prepare-build.sh && image-platforms/common/prepare-build.sh 18 | 19 | FROM debian:stretch 20 | COPY --from=builder /usr/src/n2n/supernode /usr/bin 21 | 22 | EXPOSE 7654 7654/udp 23 | EXPOSE 5645 5645/udp 24 | 25 | ENTRYPOINT ["/usr/bin/supernode", "-f"] -------------------------------------------------------------------------------- /image-platforms/Dockerfile.arm32v7: -------------------------------------------------------------------------------- 1 | FROM multiarch/debian-debootstrap:armhf-stretch AS builder 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | 5 | COPY ./image-platforms/common/dependencies.pkglist /tmp 6 | 7 | RUN apt-get update \ 8 | && cat tmp/dependencies.pkglist | xargs apt-get install -y --no-install-recommends \ 9 | && rm -rf /var/lib/apt/lists/* 10 | 11 | ARG COMMIT_HASH 12 | 13 | COPY ./ /usr/src/n2n 14 | 15 | WORKDIR /usr/src/n2n 16 | 17 | RUN chmod +x image-platforms/common/prepare-build.sh && image-platforms/common/prepare-build.sh 18 | 19 | FROM arm32v7/debian:stretch 20 | COPY --from=builder /usr/src/n2n/supernode /usr/bin 21 | 22 | EXPOSE 7654 7654/udp 23 | EXPOSE 5645 5645/udp 24 | 25 | ENTRYPOINT ["/usr/bin/supernode", "-f"] -------------------------------------------------------------------------------- /image-platforms/Dockerfile.arm64v8: -------------------------------------------------------------------------------- 1 | FROM multiarch/debian-debootstrap:arm64-stretch AS builder 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | 5 | COPY ./image-platforms/common/dependencies.pkglist /tmp 6 | 7 | RUN apt-get update \ 8 | && cat tmp/dependencies.pkglist | xargs apt-get install -y --no-install-recommends \ 9 | && rm -rf /var/lib/apt/lists/* 10 | 11 | ARG COMMIT_HASH 12 | 13 | COPY ./ /usr/src/n2n 14 | 15 | WORKDIR /usr/src/n2n 16 | 17 | RUN chmod +x image-platforms/common/prepare-build.sh && image-platforms/common/prepare-build.sh 18 | 19 | FROM arm64v8/debian:stretch 20 | COPY --from=builder /usr/src/n2n/supernode /usr/bin 21 | 22 | EXPOSE 7654 7654/udp 23 | EXPOSE 5645 5645/udp 24 | 25 | ENTRYPOINT ["/usr/bin/supernode", "-f"] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 SuperMock 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Supernode Docker Image (Image based on Debian) 2 | 3 | ## About the project 4 | 5 | This repository is just a project builder (https://github.com/ntop/n2n), any problem should be reported to the source repository unless it is about building it. I have no link with the owners of the code I just set up a constructor, which also makes a supernode container available. 6 | 7 | >*Note:* This build system was merged with the official n2n repository, but it was updated today 04/02/2020, so that you can build externally to the official n2n repository. 8 | 9 | ## Running the supernode image 10 | 11 | ```sh 12 | $ docker run --rm -d -p 5645:5645/udp -p 7654:7654/udp supermock/supernode:[TAGNAME] 13 | ``` 14 | 15 | ## Docker registry 16 | 17 | - [DockerHub](https://hub.docker.com/r/supermock/supernode/) 18 | - [DockerStore](https://store.docker.com/community/images/supermock/supernode/) 19 | 20 | ## Documentation 21 | 22 | ### 1. Build image and binaries 23 | 24 | Use `make` command to build the images. Before starting the arm64v8 or arm32v7 platform build, you need to run this registry, so you can perform a cross-build. Just follow the documentation: https://github.com/multiarch/qemu-user-static/blob/master/README.md 25 | 26 | ```sh 27 | $ N2N_COMMIT_HASH=[(optional)] N2N_VERSION=[sample 2.4, (required)] TARGET_ARCHITECTURE=[arm64v8, arm32v7, x86_64, (nothing to build all architectures)] make platforms 28 | ``` 29 | 30 | ### 2. Push it 31 | 32 | Use `make push` command to push the image, TARGET_ARCHITECTURE is necessary. 33 | 34 | ```sh 35 | $ N2N_VERSION=[sample 2.4, (required)] TARGET_ARCHITECTURE=[arm64v8, arm32v7, x86_64] make push 36 | ``` 37 | 38 | ### 3. Test it 39 | 40 | Once the image is built, it's ready to run: 41 | 42 | ```sh 43 | $ docker run --rm -d -p 5645:5645/udp -p 7654:7654/udp supermock/supernode:[TAGNAME] 44 | ``` 45 | 46 | ## Contributions 47 | 48 | Just download the code make your change and send a pull request explaining the purpose if it is a bug or an improvement and etc... After this will be analyzed to be approved. Note: If it is a major change, open a issue explaining what will be done so you do not waste your precious time developing something that will not be used. Make yourself at home! 49 | 50 | ## License 51 | 52 | MIT -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | DOCKER_IMAGE_NAME=supermock/supernode 2 | DOCKER_IMAGE_VERSION=v$(N2N_VERSION) 3 | DOCKER_BUILD_CONTEXT=./n2n 4 | 5 | clone_n2n: 6 | git clone https://github.com/ntop/n2n 7 | 8 | pre_target: 9 | if [ ! -d ./n2n ]; then echo "Before continue please execute 'make clone_n2n' command"; exit 1; fi 10 | if [ "$(N2N_VERSION)" = "" ]; then echo "Required N2N_VERSION, example: 2.4"; exit 1; fi 11 | 12 | platforms: pre_target 13 | if [ "$(TARGET_ARCHITECTURE)" = "arm64v8" ] || [ "$(TARGET_ARCHITECTURE)" = "" ]; then DOCKER_IMAGE_FILENAME="Dockerfile.arm64v8" DOCKER_IMAGE_TAGNAME=$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-arm64v8 make build; fi 14 | if [ "$(TARGET_ARCHITECTURE)" = "arm32v7" ] || [ "$(TARGET_ARCHITECTURE)" = "" ]; then DOCKER_IMAGE_FILENAME="Dockerfile.arm32v7" DOCKER_IMAGE_TAGNAME=$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-arm32v7 make build; fi 15 | if [ "$(TARGET_ARCHITECTURE)" = "x86_64" ] || [ "$(TARGET_ARCHITECTURE)" = "" ]; then DOCKER_IMAGE_FILENAME="Dockerfile.x86_64" DOCKER_IMAGE_TAGNAME=$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-x86_64 make build; fi 16 | 17 | build: 18 | $(eval OS := $(shell uname -s)) 19 | $(eval ARCHITECTURE := $(shell export DOCKER_IMAGE_TAGNAME="$(DOCKER_IMAGE_TAGNAME)"; echo $$DOCKER_IMAGE_TAGNAME | grep -oe -.*)) 20 | 21 | docker build --target builder --build-arg COMMIT_HASH=$(N2N_COMMIT_HASH) -t $(DOCKER_IMAGE_TAGNAME) -f image-platforms/$(DOCKER_IMAGE_FILENAME) $(DOCKER_BUILD_CONTEXT) 22 | 23 | docker container create --name n2n-builder $(DOCKER_IMAGE_TAGNAME) 24 | if [ ! -d "./build" ]; then mkdir ./build; fi 25 | docker container cp n2n-builder:/usr/src/n2n/supernode ./build/supernode-$(OS)$(ARCHITECTURE) 26 | docker container cp n2n-builder:/usr/src/n2n/edge ./build/edge-$(OS)$(ARCHITECTURE) 27 | docker container rm -f n2n-builder 28 | 29 | docker build --cache-from $(DOCKER_IMAGE_TAGNAME) \ 30 | --build-arg COMMIT_HASH=$(N2N_COMMIT_HASH) \ 31 | -t $(DOCKER_IMAGE_TAGNAME) \ 32 | -t $(DOCKER_IMAGE_NAME):latest$(ARCHITECTURE) \ 33 | -f image-platforms/$(DOCKER_IMAGE_FILENAME) $(DOCKER_BUILD_CONTEXT) 34 | 35 | pre_push: pre_target 36 | if [ "$(TARGET_ARCHITECTURE)" = "" ]; then \ 37 | echo "Please pass TARGET_ARCHITECTURE, see README.md."; \ 38 | exit 1; \ 39 | fi 40 | 41 | push: pre_push 42 | docker push $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_VERSION)-$(TARGET_ARCHITECTURE) 43 | docker push $(DOCKER_IMAGE_NAME):latest-$(TARGET_ARCHITECTURE) 44 | 45 | .PHONY: clone_n2n pre_target platforms build pre_push push 46 | .SILENT: pre_target pre_push --------------------------------------------------------------------------------