rework docker for building versioned images from deb packages.

This commit is contained in:
Stanislav Lechev [0xAF] 2023-07-04 23:29:15 +03:00
parent bc4694f683
commit 6bcfcf0b63
5 changed files with 248 additions and 8 deletions

View File

@ -19,13 +19,15 @@ usage () {
echo "Usage: ${0} [command]"
echo "Available commands:"
echo " help Show this usage information"
echo " build Build all docker images"
echo " push Push built docker images to the docker hub"
echo " buildn Build full docker nightly image"
echo " buildr Build full docker release image"
echo " pushn Push built docker nightly image to the docker hub"
echo " pushr Push built docker release image to the docker hub"
echo " manifest Compile the docker hub manifest (combines arm and x86 tags into one)"
echo " tag Tag a release"
}
build () {
buildn () {
# build the base images
echo -ne "\n\nBuilding the base image.\n\n"
time docker build --pull -t ${DH_PROJECT}-base:${ARCHTAG} -f docker/Dockerfiles/Dockerfile-base .
@ -50,7 +52,7 @@ build () {
docker tag ${DH_USERNAME}/${DH_PROJECT}-full ${DH_USERNAME}/${DH_PROJECT}-nightly
}
push () {
pushn () {
#for image in ${IMAGES}; do
# docker push ${DH_USERNAME}/${image}:${ARCHTAG}
#done
@ -58,6 +60,32 @@ push () {
docker push ${DH_USERNAME}/${DH_PROJECT}-nightly
}
buildr () {
if [[ -z ${1:-} ]] ; then
echo "Usage: ${0} buildr [version]"
echo "NOTE: The version will be used for tagging."
echo "The image will be build from the current packages in the apt-repo."
echo; echo;
return
fi
echo -ne "\n\nBuilding release image: $1.\n\n"
docker build --pull --build-arg VERSION=$1 -t ${DH_USERNAME}/${DH_PROJECT}:${1} -f docker/deb_based/Dockerfile .
docker tag ${DH_USERNAME}/${DH_PROJECT}:${1} ${DH_USERNAME}/${DH_PROJECT}
}
pushr () {
if [[ -z ${1:-} ]] ; then
echo "Usage: ${0} pushr [version]"
echo; echo;
return
fi
docker push ${DH_USERNAME}/${DH_PROJECT}:${1}
docker push ${DH_USERNAME}/${DH_PROJECT}
}
manifest () {
for image in ${IMAGES}; do
# there's no docker manifest rm command, and the create --amend does not work, so we have to clean up manually
@ -110,11 +138,17 @@ run () {
}
case ${1:-} in
build)
build
buildn)
buildn
;;
push)
push
pushn)
pushn
;;
buildr)
buildr ${@:2}
;;
pushr)
pushr ${@:2}
;;
manifest)
manifest

View File

@ -0,0 +1,22 @@
FROM debian:bullseye-slim
ARG VERSION
LABEL OpenWebRX+ with All Receivers and Demodulators
ADD docker/files /files
COPY docker/deb_based/install-owrxp.sh docker/scripts/run.sh /
RUN /install-owrxp.sh
COPY docker/deb_based/install-owrxp-extra.sh /
RUN /install-owrxp-extra.sh
ENV S6_CMD_ARG0="/run.sh"
ENTRYPOINT ["/init"]
WORKDIR /
VOLUME /etc/openwebrx
VOLUME /var/lib/openwebrx
CMD []
EXPOSE 8073

18
docker/deb_based/Makefile Normal file
View File

@ -0,0 +1,18 @@
DATE=$(shell date +%F)
all:
@docker build -t openwebrxplus-softmbe:$(DATE) -t openwebrxplus-softmbe .
run:
@docker run --rm -h openwebrxplus-softmbe --name openwebrxplus-softmbe --device /dev/bus/usb -p 8073:8073 -v openwebrxplus-settings:/var/lib/openwebrx openwebrxplus-softmbe
admin:
@docker exec -it openwebrxplus-softmbe /usr/bin/openwebrx admin adduser af
push:
@docker tag openwebrxplus-softmbe:$(DATE) slechev/openwebrxplus-softmbe:$(DATE)
@docker tag openwebrxplus-softmbe:$(DATE) slechev/openwebrxplus-softmbe:latest
@docker push slechev/openwebrxplus-softmbe:$(DATE)
@docker push slechev/openwebrxplus-softmbe
dev:
@S6_CMD_ARG0=/bin/bash docker run -it --rm -p 8073:8073 --device /dev/bus/usb --name owrxp-build --entrypoint /bin/bash openwebrxplus-softmbe

View File

@ -0,0 +1,130 @@
#!/bin/bash
set -euxo pipefail
export MAKEFLAGS="-j12"
function cmakebuild() {
cd $1
if [[ ! -z "${2:-}" ]]; then
git checkout $2
fi
if [[ -f ".gitmodules" ]]; then
git submodule update --init
fi
mkdir build
cd build
cmake ${CMAKE_ARGS:-} ..
make
make install
cd ../..
rm -rf $1
}
case `uname -m` in
arm*)
SDRPLAY_BINARY=SDRplay_RSP_API-ARM32-3.07.2.run
;;
aarch64*)
SDRPLAY_BINARY=SDRplay_RSP_API-ARM64-3.07.1.run
;;
x86_64*)
SDRPLAY_BINARY=SDRplay_RSP_API-Linux-3.07.1.run
;;
esac
echo "+ Install dev packages..."
BUILD_PACKAGES="git cmake make patch wget sudo gcc g++ libusb-1.0-0-dev libsoapysdr-dev debhelper cmake libprotobuf-dev protobuf-compiler libcodecserver-dev build-essential xxd qt5-qmake libpulse-dev libfaad-dev libopus-dev libfftw3-dev pkg-config libglib2.0-dev libconfig++-dev libliquid-dev libairspyhf-dev libpopt-dev libiio-dev libad9361-dev libhidapi-dev libasound2-dev qtmultimedia5-dev libqt5serialport5-dev qttools5-dev qttools5-dev-tools libboost-all-dev libfftw3-dev libreadline-dev libusb-1.0-0-dev libudev-dev asciidoctor gfortran libhamlib-dev"
apt-get -y install --no-install-recommends $BUILD_PACKAGES
echo "+ Install SDRPlay..."
wget --no-http-keep-alive https://www.sdrplay.com/software/$SDRPLAY_BINARY
sh $SDRPLAY_BINARY --noexec --target sdrplay
patch --verbose -Np0 < /files/sdrplay/install-lib.`uname -m`.patch
cd sdrplay
mkdir -p /etc/udev/rules.d
./install_lib.sh
cd ..
rm -rf sdrplay
rm $SDRPLAY_BINARY
echo "+ Install PerseusSDR..."
git clone https://github.com/Microtelecom/libperseus-sdr.git
cd libperseus-sdr
# latest from master as of 2020-09-04
git checkout c2c95daeaa08bf0daed0e8ada970ab17cc264e1b
./bootstrap.sh
./configure
make
make install
ldconfig /etc/ld.so.conf.d
cd ..
rm -rf libperseus-sdr
echo "+ Install AirSpyHF+..."
git clone https://github.com/pothosware/SoapyAirspyHF.git
cmakebuild SoapyAirspyHF 5488dac5b44f1432ce67b40b915f7e61d3bd4853
echo "+ Install RockOProg..."
git clone https://github.com/0xAF/rockprog-linux
cd rockprog-linux
make
cp rockprog /usr/local/bin/
cd ..
rm -rf rockprog-linux
echo "+ Install PlutoSDR..."
git clone https://github.com/pothosware/SoapyPlutoSDR.git
cmakebuild SoapyPlutoSDR 93717b32ef052e0dfa717aa2c1a4eb27af16111f
echo "+ Install FCDPP..."
git clone https://github.com/pothosware/SoapyFCDPP.git
cmakebuild SoapyFCDPP soapy-fcdpp-0.1.1
echo "+ Install FreeDV..."
git clone https://github.com/drowe67/codec2.git
cd codec2
mkdir build
cd build
cmake ..
make
make install
install -m 0755 src/freedv_rx /usr/local/bin
cd ../..
rm -rf codec2
echo "+ Install wsjtx..."
WSJT_DIR=wsjtx-2.6.1
WSJT_TGZ=${WSJT_DIR}.tgz
wget https://downloads.sourceforge.net/project/wsjt/${WSJT_DIR}/${WSJT_TGZ}
tar xfz ${WSJT_TGZ}
patch -Np0 -d ${WSJT_DIR} < /files/wsjtx/wsjtx-hamlib.patch
mv /files/wsjtx/wsjtx.patch ${WSJT_DIR}
cmakebuild ${WSJT_DIR}
rm ${WSJT_TGZ}
echo "+ Install HFDL..."
git clone https://github.com/szpajder/libacars.git
cmakebuild libacars v2.1.4
git clone https://github.com/szpajder/dumphfdl.git
cmakebuild dumphfdl v1.4.1
echo "+ Install Dream (DRM)..."
wget https://downloads.sourceforge.net/project/drm/dream/2.1.1/dream-2.1.1-svn808.tar.gz
tar xvfz dream-2.1.1-svn808.tar.gz
pushd dream
patch -Np0 < /files/dream/dream.patch
qmake CONFIG+=console
make
make install
popd
rm -rf dream
rm dream-2.1.1-svn808.tar.gz
echo "+ Clean..."
SUDO_FORCE_REMOVE=yes apt-get -y purge --autoremove $BUILD_PACKAGES systemd udev dbus
apt-get clean
rm -rf /var/lib/apt/lists/*
rm -rf /files

View File

@ -0,0 +1,36 @@
#!/bin/bash
set -euxo pipefail
export MAKEFLAGS="-j12"
case `uname -m` in
arm*)
PLATFORM=armhf
;;
aarch64*)
PLATFORM=aarch64
;;
x86_64*)
PLATFORM=amd64
;;
esac
echo "+ Init..."
apt update
apt install -y --no-install-recommends wget gpg ca-certificates auto-apt-proxy udev
echo "+ Install S6 services..."
wget https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-${PLATFORM}.tar.gz
tar xzf s6-overlay-${PLATFORM}.tar.gz -C /
rm s6-overlay-${PLATFORM}.tar.gz
mv /files/services/sdrplay /etc/services.d/
sed -ri 's/^python3 openwebrx.py/openwebrx/' /run.sh
echo "+ Add repos and update..."
wget -O - https://luarvique.github.io/ppa/openwebrx-plus.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/openwebrx-plus.gpg
echo "deb [signed-by=/etc/apt/trusted.gpg.d/openwebrx-plus.gpg] https://luarvique.github.io/ppa/debian ./" > /etc/apt/sources.list.d/openwebrx-plus.list
wget -O - https://repo.openwebrx.de/debian/key.gpg.txt | gpg --dearmor -o /usr/share/keyrings/openwebrx.gpg
echo "deb [signed-by=/usr/share/keyrings/openwebrx.gpg] https://repo.openwebrx.de/debian/ bullseye main" > /etc/apt/sources.list.d/openwebrx.list
apt update
echo "+ Install OpenWebRX, Soapy modules and some libs..."
DEBIAN_FRONTEND=noninteractive apt install -y openwebrx soapysdr-module-all libpulse0 libfaad2 libopus0 soapysdr-module-sdrplay3 airspyhf alsa-utils libpopt0 libiio0 libad9361-0 libhidapi-hidraw0 libhidapi-libusb0