From 03174253eafa97cd749de8a4ed1fee1aeb850953 Mon Sep 17 00:00:00 2001 From: KeithSSmith Date: Thu, 27 Sep 2018 08:50:57 +0000 Subject: [PATCH] Build for Raspberry Pi 3 --- Dockerfile.armv7 | 18 ++++++++++++++++++ Dockerfile.armv7.config | 30 ++++++++++++++++++++++++++++++ build_armv7.sh | 33 +++++++++++++++++++++++++++++++++ noip.sh | 14 ++++++++++++-- 4 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 Dockerfile.armv7 create mode 100644 Dockerfile.armv7.config create mode 100644 build_armv7.sh diff --git a/Dockerfile.armv7 b/Dockerfile.armv7 new file mode 100644 index 0000000..5768e16 --- /dev/null +++ b/Dockerfile.armv7 @@ -0,0 +1,18 @@ +FROM noip-config + +MAINTAINER David Coppit + +ENV TERM=xterm-256color + +RUN true && \ +# RunIt stuff +adduser -h /home/user-service -s /bin/sh -D user-service -u 2000 && \ +chown user-service:user-service /home/user-service && \ +mkdir -p /etc/run_once /etc/service + +# Boilerplate startup code +COPY ./boot.sh /sbin/boot.sh +RUN chmod +x /sbin/boot.sh +CMD [ "/sbin/boot.sh" ] + +COPY ["config/no-ip2.conf", "/usr/local/etc/"] diff --git a/Dockerfile.armv7.config b/Dockerfile.armv7.config new file mode 100644 index 0000000..99d891b --- /dev/null +++ b/Dockerfile.armv7.config @@ -0,0 +1,30 @@ +FROM hypriot/rpi-alpine +#FROM resin/raspberrypi3-alpine:3.6 + +MAINTAINER David Coppit + +ENV TERM=xterm-256color + +RUN true && \ +\ +echo "http://dl-cdn.alpinelinux.org/alpine/v3.6/community" >> /etc/apk/repositories && \ +apk --update upgrade && \ +\ +# Basics, including runit +apk add bash curl htop runit && \ +\ +# Needed by our code +apk add expect libc6-compat && \ +\ +# Alpine Build Tools +apk add alpine-sdk && \ +\ +rm -rf /var/cache/apk/* + +ADD https://www.noip.com/client/linux/noip-duc-linux.tar.gz /files/ + +RUN set -x && \ + chmod a+rwX /files && \ + tar -C /files -x -f /files/noip-duc-linux.tar.gz && \ + make -C /files/noip-2.1.9-1 && \ + cp /files/noip-2.1.9-1/noip2 /usr/local/bin/noip2 diff --git a/build_armv7.sh b/build_armv7.sh new file mode 100644 index 0000000..8e1d68f --- /dev/null +++ b/build_armv7.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +DOCKER_NAME=noip +DOCKER_PATH=$(pwd) + +docker stop ${DOCKER_NAME} +docker rm ${DOCKER_NAME} +docker rmi ${DOCKER_NAME} + +docker build \ + -t ${DOCKER_NAME}-config \ + -f ${DOCKER_PATH}/Dockerfile.armv7.config \ + ${DOCKER_PATH} + +docker rm noip-config + +docker run -i -t \ + --name noip-config \ + -v ${DOCKER_PATH}/config/:/config \ + noip-config bash -c 'make -C /files/noip-2.1.9-1 install; cp /usr/local/etc/no-ip2.conf /config' + +docker build \ + -t ${DOCKER_NAME} \ + -f ${DOCKER_PATH}/Dockerfile.armv7 \ + ${DOCKER_PATH} + +docker rm ${DOCKER_NAME} + +docker run -td \ + --name=${DOCKER_NAME} \ + --restart=unless-stopped \ + -v /etc/localtime:/etc/localtime \ + ${DOCKER_NAME} diff --git a/noip.sh b/noip.sh index 28d8a7c..447ec0f 100644 --- a/noip.sh +++ b/noip.sh @@ -13,14 +13,24 @@ function ts { while true do echo "$(ts) Launching the noip2 daemon" - /files/noip2-x86_64 -c "$GENERATED_CONFIG_FILE" + if [[ -z $(uname -a | grep "arm") ]] + then + /files/noip2-x86_64 -c "$GENERATED_CONFIG_FILE" + else + /usr/local/bin/noip2 + fi # Give it a few seconds to do the first update. This helps avoid questions about "Last IP Address set 0.0.0.0" sleep 5 while true do - output=$(/files/noip2-x86_64 -c "$GENERATED_CONFIG_FILE" -S 2>&1) + if [[ -z $(uname -a | grep "arm") ]] + then + output=$(/files/noip2-x86_64 -c "$GENERATED_CONFIG_FILE" -S 2>&1) + else + output=$(/usr/local/bin/noip2 -S 2>&1) + fi echo "$(ts) Current status" echo "$output"