From dea09d8eaaa4064bf7b753a7c15602a6cdbf272e Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Tue, 22 Jan 2019 12:52:03 +0100 Subject: [PATCH] multi-platform build --- build.sh | 25 ++++++++++++++++--- docker/Dockerfiles/Dockerfile-base | 3 ++- .../scripts/install-dependencies-sdrplay.sh | 17 ++++++++++--- push.sh | 12 ++++++--- 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/build.sh b/build.sh index 9525b88..7d85499 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,24 @@ #!/bin/bash set -euxo pipefail -docker build -t openwebrx-base -f docker/Dockerfiles/Dockerfile-base . -docker build -t jketterl/openwebrx-rtlsdr -t jketterl/openwebrx -f docker/Dockerfiles/Dockerfile-rtlsdr . -docker build -t jketterl/openwebrx-sdrplay -f docker/Dockerfiles/Dockerfile-sdrplay . + +ARCH=$(uname -m) + +case $ARCH in + x86_64) + BASE_IMAGE=debian:stretch + ;; + armv*) + BASE_IMAGE=raspbian/stretch +esac + +TAGS=$ARCH + +docker build --build-arg BASE_IMAGE=$BASE_IMAGE -t openwebrx-base:$ARCH -f docker/Dockerfiles/Dockerfile-base . +docker build -t jketterl/openwebrx-rtlsdr:$ARCH -t jketterl/openwebrx:$ARCH -f docker/Dockerfiles/Dockerfile-rtlsdr . +docker build -t jketterl/openwebrx-sdrplay:$ARCH -f docker/Dockerfiles/Dockerfile-sdrplay . + +if [ "$ARCH" == "armv7l" ]; then + for image in openwebrx openwebrx-rtlsdr openwebrx-sdrplay; do + docker tag jketterl/$image:$ARCH jketterl/$image:latest + done +fi diff --git a/docker/Dockerfiles/Dockerfile-base b/docker/Dockerfiles/Dockerfile-base index 54dfbdf..3f30eb5 100644 --- a/docker/Dockerfiles/Dockerfile-base +++ b/docker/Dockerfiles/Dockerfile-base @@ -1,4 +1,5 @@ -FROM raspbian/stretch +ARG BASE_IMAGE +FROM $BASE_IMAGE ADD docker/scripts/install-dependencies.sh / RUN /install-dependencies.sh diff --git a/docker/scripts/install-dependencies-sdrplay.sh b/docker/scripts/install-dependencies-sdrplay.sh index 77ef381..4961057 100755 --- a/docker/scripts/install-dependencies-sdrplay.sh +++ b/docker/scripts/install-dependencies-sdrplay.sh @@ -20,8 +20,17 @@ BUILD_PACKAGES="git build-essential cmake patch ca-certificates wget sudo udev" apt-get update apt-get -y install --no-install-recommends $STATIC_PACKAGES $BUILD_PACKAGES -wget http://www.sdrplay.com/software/SDRplay_RSP_API-RPi-2.13.1.run -sh SDRplay_RSP_API-RPi-2.13.1.run --noexec --target sdrplay +case $(arch) in + x86_64) + BINARY=SDRplay_RSP_API-Linux-2.13.1.run + ;; + armv*) + BINARY=SDRplay_RSP_API-RPi-2.13.1.run + ;; +esac + +wget http://www.sdrplay.com/software/$BINARY +sh $BINARY --noexec --target sdrplay patch -Np0 <<'EOF' --- sdrplay/install_lib.sh 2018-06-20 23:57:02.000000000 +0000 +++ sdrplay/install_lib_patched.sh 2019-01-13 17:52:56.723838354 +0000 @@ -49,7 +58,7 @@ cd sdrplay ./install_lib.sh cd .. rm -rf sdrplay -rm SDRplay_RSP_API-RPi-2.13.1.run +rm $BINARY git clone https://github.com/pothosware/SoapySDR cmakebuild SoapySDR @@ -60,6 +69,6 @@ cmakebuild SoapySDRPlay git clone https://github.com/rxseger/rx_tools cmakebuild rx_tools -apt-get remove --purge --autoremove -y $BUILD_PACKAGES +SUDO_FORCE_REMOVE=yes apt-get remove --purge --autoremove -y $BUILD_PACKAGES rm -rf /var/lib/apt/lists/* diff --git a/push.sh b/push.sh index 345b566..318e059 100755 --- a/push.sh +++ b/push.sh @@ -1,5 +1,11 @@ #!/bin/bash set -euxo pipefail -docker push jketterl/openwebrx -docker push jketterl/openwebrx-rtlsdr -docker push jketterl/openwebrx-sdrplay + +ARCH=$(uname -m) + +for image in openwebrx openwebrx-rtlsdr openwebrx-sdrplay; do + docker push jketterl/$image:$ARCH + if [ "$ARCH" == "armv7l" ]; then + docker push jketterl/$image:latest + fi +done