mirror of
https://github.com/minoplhy/docker-ripe-atlas.git
synced 2025-04-21 12:26:59 +00:00
Support multiarch through cross-compilation
This commit is contained in:
parent
3b541d4e0c
commit
25f2d55d7c
42
Dockerfile
42
Dockerfile
@ -1,19 +1,48 @@
|
||||
## builder
|
||||
FROM debian:10-slim as builder
|
||||
FROM --platform=$BUILDPLATFORM debian:stable-slim as builder
|
||||
LABEL image="ripe-atlas-builder"
|
||||
ARG BUILDPLATFORM
|
||||
ARG TARGETPLATFORM
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG GIT_URL=https://github.com/RIPE-NCC/ripe-atlas-software-probe.git
|
||||
|
||||
RUN apt-get update -y \
|
||||
&& apt-get install -y git tar fakeroot libssl-dev libcap2-bin autoconf automake libtool build-essential python
|
||||
|
||||
WORKDIR /root
|
||||
|
||||
RUN if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ] ; then \
|
||||
case ${TARGETPLATFORM} in \
|
||||
"linux/arm64") echo 'export CROSSBUILD_ARCH=arm64 CROSS_COMPILE_TARGET=aarch64-linux-gnu' > env ;; \
|
||||
"linux/arm/v6") echo 'export CROSSBUILD_ARCH=armel CROSS_COMPILE_TARGET=arm-linux-gnueabi' > env ;; \
|
||||
"linux/arm/v7") echo 'export CROSSBUILD_ARCH=armhf CROSS_COMPILE_TARGET=arm-linux-gnueabihf' > env ;; \
|
||||
"linux/386") echo 'export CROSSBUILD_ARCH=i386 CROSS_COMPILE_TARGET=i686-linux-gnu' > env ;; \
|
||||
"linux/amd64") echo 'export CROSSBUILD_ARCH=amd64 CROSS_COMPILE_TARGET=x86_64-linux-gnu' > env ;; \
|
||||
*) echo "Unsupported platform"; exit 1 ;; \
|
||||
esac \
|
||||
&& . ./env \
|
||||
&& dpkg --add-architecture $CROSSBUILD_ARCH \
|
||||
&& apt-get update -y \
|
||||
&& apt-get install -y libssl-dev:$CROSSBUILD_ARCH crossbuild-essential-$CROSSBUILD_ARCH; \
|
||||
fi \
|
||||
&& apt-get update -y \
|
||||
&& apt-get install -y git tar fakeroot libssl-dev libcap2-bin autoconf automake libtool build-essential
|
||||
|
||||
RUN git clone --recursive "$GIT_URL"
|
||||
RUN ./ripe-atlas-software-probe/build-config/debian/bin/make-deb
|
||||
|
||||
RUN if [ "$BUILDPLATFORM" != "$TARGETPLATFORM" ] ; then \
|
||||
. ./env \
|
||||
&& export CROSS_COMPILE="$CROSS_COMPILE_TARGET-" \
|
||||
&& sed -i 's/.\/configure/.\/configure --host='$CROSS_COMPILE_TARGET'/g' ./ripe-atlas-software-probe/build-config/debian/bin/make-deb \
|
||||
&& sed -i 's/ARCH=$(get_arch)/ARCH='$CROSSBUILD_ARCH'/g' ./ripe-atlas-software-probe/build-config/debian/bin/make-deb; \
|
||||
fi \
|
||||
&& ./ripe-atlas-software-probe/build-config/debian/bin/make-deb
|
||||
|
||||
## artifacts
|
||||
FROM scratch AS artifacts
|
||||
LABEL image="ripe-atlas-artifacts"
|
||||
|
||||
COPY --from=builder /root/atlasswprobe-*.deb /
|
||||
|
||||
## the actual image
|
||||
FROM debian:10-slim
|
||||
FROM debian:stable-slim
|
||||
LABEL maintainer="dockerhub@public.swineson.me"
|
||||
LABEL image="ripe-atlas"
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
@ -46,4 +75,3 @@ VOLUME [ "/var/atlas-probe/etc", "/var/atlas-probe/status" ]
|
||||
|
||||
ENTRYPOINT [ "entrypoint.sh" ]
|
||||
CMD [ "atlas" ]
|
||||
|
||||
|
34
README.md
34
README.md
@ -12,13 +12,6 @@ This is the [RIPE Atlas software probe](https://atlas.ripe.net/docs/software-pro
|
||||
* A Linux installation with Docker installed
|
||||
* Internet access
|
||||
|
||||
## Tags
|
||||
|
||||
The following prebuilt tags are available at [Docker Hub](https://hub.docker.com/r/jamesits/ripe-atlas):
|
||||
|
||||
* `latest`: For arm64 (x86\_64) devices
|
||||
* `latest-armv7l`: For armv7l (armhf) devices, e.g. Raspberry Pi (CI donated by [@OtakuNekoP](https://github.com/OtakuNekoP))
|
||||
|
||||
## Running
|
||||
|
||||
First we start the container:
|
||||
@ -47,7 +40,9 @@ cat /var/atlas-probe/etc/probe_key.pub
|
||||
|
||||
### IPv6
|
||||
|
||||
Docker's IPv6 support is still [like shit](https://github.com/moby/moby/issues/25407). As a workaround, you can use IPv6 NAT like this:
|
||||
Docker's IPv6 support is still [like shit](https://github.com/moby/moby/issues/25407). As a workaround, you can use IPv6 NAT using either `docker-ipv6nat` or native method (experimental).
|
||||
|
||||
First, edit kernel parameters.
|
||||
|
||||
```shell
|
||||
cat > /etc/sysctl.d/50-docker-ipv6.conf <<EOF
|
||||
@ -56,13 +51,31 @@ net.ipv6.conf.all.forwarding=1
|
||||
net.ipv6.conf.default.forwarding=1
|
||||
EOF
|
||||
sysctl -p /etc/sysctl.d/50-docker-ipv6.conf
|
||||
```
|
||||
|
||||
Note this might break your network and your mileage may vary. You should swap `eth0` with your primary network adapter name, and if you use static IPv6 assignment instead of SLAAC, change `accept_ra` to `0`.
|
||||
|
||||
#### Using robbertkl/docker-ipv6nat
|
||||
|
||||
```shell
|
||||
docker network create --ipv6 --subnet=fd00:a1a3::/48 ripe-atlas-network
|
||||
docker run -d --restart=always -v /var/run/docker.sock:/var/run/docker.sock:ro -v /lib/modules:/lib/modules:ro --cap-drop=ALL --cap-add=NET_RAW --cap-add=NET_ADMIN --cap-add=SYS_MODULE --net=host --name=ipv6nat robbertkl/ipv6nat:latest
|
||||
```
|
||||
|
||||
Then start the RIPE Atlas container with argument `--net=ripe-atlas-network`.
|
||||
|
||||
Note this might break your network and your mileage may vary. You should swap `eth0` with your primary network adapter name, and if you use static IPv6 assignment instead of SLAAC, change `accept_ra` to `0`.
|
||||
#### Using native method (experimental)
|
||||
|
||||
Edit `/etc/docker/daemon.json`, then restart docker daemon.
|
||||
|
||||
```json
|
||||
{
|
||||
"experimental": true,
|
||||
"ipv6": true,
|
||||
"ip6tables": true,
|
||||
"fixed-cidr-v6": "fd00:a1a3::/48"
|
||||
}
|
||||
```
|
||||
|
||||
### Auto Update
|
||||
|
||||
@ -78,3 +91,6 @@ Then start the RIPE Atlas container with argument `--label=com.centurylinklabs.w
|
||||
|
||||
All the config files are stored at `/var/atlas-probe`. Just backup it.
|
||||
|
||||
### BuildKit
|
||||
|
||||
The `Dockerfile` requires [BuildKit](https://docs.docker.com/develop/develop-images/build_enhancements/).
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user