SDRangel in Docker: reorganize docker tree and added readme

This commit is contained in:
f4exb 2019-03-04 11:55:48 +01:00
parent 5e64a98dca
commit 61ab300628
18 changed files with 181 additions and 21 deletions

View File

@ -0,0 +1,3 @@
build.sh
gui/
server/

View File

@ -4,7 +4,10 @@ ENV DEBIAN_FRONTEND=noninteractive
# Create a user with sudo rights
RUN apt-get update && apt-get -y install sudo
RUN useradd -m sdr && echo "sdr:sdr" | chpasswd && adduser sdr sudo
RUN useradd -m sdr && echo "sdr:sdr" | chpasswd \
&& adduser sdr sudo \
&& usermod -a -G audio,dialout,plugdev sdr\
&& sudo usermod --shell /bin/bash sdr
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER sdr
@ -14,11 +17,8 @@ RUN sudo apt-get update && sudo apt-get -y install \
openssh-server \
iputils-ping \
traceroute \
iproute2
# Configure SSH for X-forwarding
RUN sudo sed -i '/X11Forwarding/c\X11Forwarding yes' /etc/ssh/sshd_config \
&& sudo sed -i '/X11UseLocalhost/c\X11UseLocalhost no' /etc/ssh/sshd_config
iproute2 \
nmap
# Prepare buiid and install environment
RUN sudo mkdir /opt/build /opt/install \
@ -69,7 +69,8 @@ RUN sudo apt-get update && sudo apt-get -y install \
ffmpeg \
libavcodec-dev \
libavformat-dev \
libopus-dev
libopus-dev \
libavahi-client-dev
# CM256cc
RUN cd /opt/build \
@ -215,7 +216,6 @@ RUN cd /opt/build \
&& make -j4 install
# Soapy remote
RUN sudo apt-get update && sudo apt-get -y install libavahi-client-dev
RUN cd /opt/build \
&& git clone https://github.com/pothosware/SoapyRemote.git \
&& cd SoapyRemote \
@ -223,16 +223,4 @@ RUN cd /opt/build \
&& mkdir build; cd build \
&& cmake -DCMAKE_INSTALL_PREFIX=/opt/install/SoapySDR -DSOAPY_SDR_INCLUDE_DIR=/opt/install/SoapySDR/include -DSOAPY_SDR_LIBRARY=/opt/install/SoapySDR/lib/libSoapySDR.so .. \
&& make -j4 install
# Finally SDRangel
RUN cd /opt/build \
&& git clone https://github.com/f4exb/sdrangel.git \
&& cd sdrangel \
&& mkdir build; cd build \
&& cmake -Wno-dev -DDEBUG_OUTPUT=ON -DBUILD_TYPE=RELEASE -DRX_SAMPLE_24BIT=ON -DMIRISDR_DIR=/opt/install/libmirisdr -DAIRSPY_DIR=/opt/install/libairspy -DAIRSPYHF_DIR=/opt/install/libairspyhf -DBLADERF_DIR=/opt/install/libbladeRF -DHACKRF_DIR=/opt/install/libhackrf -DRTLSDR_DIR=/opt/install/librtlsdr -DLIMESUITE_DIR=/opt/install/LimeSuite -DIIO_DIR=/opt/install/libiio -DCM256CC_DIR=/opt/install/cm256cc -DDSDCC_DIR=/opt/install/dsdcc -DSERIALDV_DIR=/opt/install/serialdv -DMBE_DIR=/opt/install/mbelib -DPERSEUS_DIR=/opt/install/libperseus -DXTRX_DIR=/opt/install/xtrx-images -DSOAPYSDR_DIR=/opt/install/SoapySDR -DCMAKE_INSTALL_PREFIX=/opt/install/sdrangel .. \
&& make -j8 install
# Start some services on which SDRangel depends
RUN sudo service ssh start \
&& sudo service dbus start \
&& sudo service avahi-daemon start

View File

@ -0,0 +1,3 @@
build.sh
linux/
vanilla/

View File

@ -0,0 +1,14 @@
FROM sdrangel/bionic:base
# Finally SDRangel
RUN cd /opt/build \
&& git clone https://github.com/f4exb/sdrangel.git \
&& cd sdrangel \
&& git reset --hard v4.5.0 \
&& mkdir build; cd build \
&& cmake -Wno-dev -DDEBUG_OUTPUT=ON -DBUILD_TYPE=RELEASE -DRX_SAMPLE_24BIT=ON -DBUILD_SERVER=OFF -DMIRISDR_DIR=/opt/install/libmirisdr -DAIRSPY_DIR=/opt/install/libairspy -DAIRSPYHF_DIR=/opt/install/libairspyhf -DBLADERF_DIR=/opt/install/libbladeRF -DHACKRF_DIR=/opt/install/libhackrf -DRTLSDR_DIR=/opt/install/librtlsdr -DLIMESUITE_DIR=/opt/install/LimeSuite -DIIO_DIR=/opt/install/libiio -DCM256CC_DIR=/opt/install/cm256cc -DDSDCC_DIR=/opt/install/dsdcc -DSERIALDV_DIR=/opt/install/serialdv -DMBE_DIR=/opt/install/mbelib -DCODEC2_DIR=/opt/install/codec2 -DPERSEUS_DIR=/opt/install/libperseus -DXTRX_DIR=/opt/install/xtrx-images -DSOAPYSDR_DIR=/opt/install/SoapySDR -DCMAKE_INSTALL_PREFIX=/opt/install/sdrangel .. \
&& make -j8 install
# Configure SSH for X-forwarding to be able to start the UI from ssh connection
RUN sudo sed -i '/X11Forwarding/c\X11Forwarding yes' /etc/ssh/sshd_config \
&& sudo sed -i '/X11UseLocalhost/c\X11UseLocalhost no' /etc/ssh/sshd_config

View File

@ -0,0 +1,4 @@
.gitignore
NVIDIA-Linux*
build.sh
run.sh

View File

@ -0,0 +1 @@
*.run

View File

@ -0,0 +1,16 @@
FROM sdrangel/bionic:gui
RUN sudo apt-get update && sudo apt-get install -y mesa-utils binutils kmod
# install nvidia driver
ADD NVIDIA-DRIVER.run /tmp/NVIDIA-DRIVER.run
RUN sudo sh /tmp/NVIDIA-DRIVER.run -s --ui=none --no-kernel-module --install-libglvnd --no-questions
RUN sudo rm /tmp/NVIDIA-DRIVER.run
# debug
RUN sudo apt-get update && sudo apt-get install -y gdb alsa-utils
RUN sudo usermod -a -G adm sdr
# Start SDRangel and some more services on which SDRangel depends
COPY start.sh /start.sh
ENTRYPOINT ["/start.sh"]

View File

@ -0,0 +1,13 @@
#!/bin/sh
COMMAND="/bin/bash"
xhost +si:localuser:root # allow connections to X server
xhost +si:localuser:${USER}
#docker run --privileged -e "DISPLAY=unix:0.0" -p 50022:22 -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" -v="/tmp/debug:/opt/build/sdrangel/debug:rw" -i -t --rm sdrangel/bionic:linux_nvidia $COMMAND
docker run -it --rm --privileged \
-e "DISPLAY=unix:0.0" \
-p 50022:22 \
-v="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
-v="/home/${USER}/.config/f4exb:/home/sdr/.config/f4exb:rw" \
sdrangel/bionic:linux_nvidia $COMMAND

View File

@ -0,0 +1,6 @@
#!/bin/bash
sudo service ssh start
sudo service dbus start
sudo service avahi-daemon start
/bin/bash
#/opt/install/sdrangel/bin/sdrangel # not ready yet

View File

@ -0,0 +1,2 @@
build.sh
run.sh

View File

@ -0,0 +1,5 @@
FROM sdrangel/bionic:gui
# Start SDRangel and some more services on which SDRangel depends
COPY start.sh /start.sh
ENTRYPOINT ["/start.sh"]

7
docker/base/gui/vanilla/run.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
COMMAND="/bin/bash"
xhost +si:localuser:root # allow connections to X server
xhost +si:localuser:${USER}
docker run --privileged -e "DISPLAY=unix:0.0" -p 50022:22 -v="/tmp/.X11-unix:/tmp/.X11-unix:rw" -v="/home/${USER}/.config/f4exb:/home/sdr/.config/f4exb:rw" -i -t --rm sdrangel/bionic:vanilla $COMMAND

View File

@ -0,0 +1,6 @@
#!/bin/bash
sudo service ssh start
sudo service dbus start
sudo service avahi-daemon start
/bin/bash
#/opt/install/sdrangel/bin/sdrangel # not ready yet

View File

@ -0,0 +1,2 @@
build.sh
run.sh

View File

@ -0,0 +1,14 @@
FROM sdrangel/bionic:base
# Finally SDRangel
RUN cd /opt/build \
&& git clone https://github.com/f4exb/sdrangel.git \
&& cd sdrangel \
&& git reset --hard v4.5.0 \
&& mkdir build; cd build \
&& cmake -Wno-dev -DDEBUG_OUTPUT=ON -DBUILD_TYPE=RELEASE -DRX_SAMPLE_24BIT=ON -DBUILD_GUI=OFF -DMIRISDR_DIR=/opt/install/libmirisdr -DAIRSPY_DIR=/opt/install/libairspy -DAIRSPYHF_DIR=/opt/install/libairspyhf -DBLADERF_DIR=/opt/install/libbladeRF -DHACKRF_DIR=/opt/install/libhackrf -DRTLSDR_DIR=/opt/install/librtlsdr -DLIMESUITE_DIR=/opt/install/LimeSuite -DIIO_DIR=/opt/install/libiio -DCM256CC_DIR=/opt/install/cm256cc -DDSDCC_DIR=/opt/install/dsdcc -DSERIALDV_DIR=/opt/install/serialdv -DMBE_DIR=/opt/install/mbelib -DCODEC2_DIR=/opt/install/codec2 -DPERSEUS_DIR=/opt/install/libperseus -DXTRX_DIR=/opt/install/xtrx-images -DSOAPYSDR_DIR=/opt/install/SoapySDR -DCMAKE_INSTALL_PREFIX=/opt/install/sdrangel .. \
&& make -j8 install
# Start SDRangel and some more services on which SDRangel depends
COPY start.sh /start.sh
ENTRYPOINT ["/start.sh"]

5
docker/base/server/run.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
COMMAND="/bin/bash"
docker run --privileged -p 50022:22 -v="/home/${USER}/.config/f4exb:/home/sdr/.config/f4exb:rw" -i -t --rm sdrangel/bionic:server $COMMAND

6
docker/base/server/start.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
sudo systemctl start ssh
sudo systemctl start dbus
sudo systemctl start avahi-daemon
/bin/bash
#/opt/install/sdrangel/bin/sdrangelsrv # not ready yet

65
docker/readme.md Normal file
View File

@ -0,0 +1,65 @@
<h1>Running SDRangel in a Docker container</h1>
&#9888; This is highly experimental and subject to large changes. Do not expect it to work in all cases.
Because SDRangel uses OpenGL this can make it possibly more difficult to run it properly on some hosts and operating systems. Some particular implementations can be derived fom a base GUI image (see "Folders organization" and "Building images" paragraphs).
<h2>Install Docker</h2>
This is of course the first step. Please check the [Docker related page](https://docs.docker.com/install/) and follow instructions related to your system.
<h3>Windows</h3>
In Windows you have two options:
- Install with Hyper-V: Hyper-V is a bare-metal type hypervisor where the Windows O/S itself runs in a VM. The catch is that it requires Windows 10 Pro version and a special set up. This is required to install _ Docker Desktop for Windows_ In this configuration a docker instance runs in its own VM
- Install with Oracle Virtualbox: Virtualbox is a hosted type hypervisor that sits on the top of the Windows O/S so it puts an extra layer on the stack but may be available on more flavors of Windows. In this case you will install Docker in a Linux O/S Virtualbox VM for example Ubuntu 18.04 and therefore you will have to follow Linux instructions.
See [this discussion](https://www.nakivo.com/blog/hyper-v-virtualbox-one-choose-infrastructure/) about the difference between Hyper-V and Virtualbox.
<h2>Get familiar with Docker</h2>
The rest of the document assumes you have some understanding on how Docker works and know its most used commands. There are tons of tutorials on the net to get familiar with Docker. Please take time to play with Docker a little bit so that you are proficient enough to know how to build and run images, start containers, etc... Be sure that this is not time wasted just to run this project. Docker is a top notch technology (although based on ancient roots) widely used in the computer industry and at the heart of many IT ecosystems.
<h2>Folders organization</h2>
This is a hierarchy of folders corresponding to an image build hierarchy. At each node building an image may be possible based on the image built previously. A terminating node always builds a final runnable image.
<h3>base</h3>
this creates a `bionic/sdrangel:base` image that is used as a base for all images. It takes an Ubuntu 18.04 base, performs all necessary packages installations then eventually compiles and installs all specific software dependencies
<h3>base/gui</h3>
this creates a `bionic/sdrangel:gui` image from the base image is used as a base for all GUI images. Essentially it compiles and installs SDRangel GUI flavor.
<h3>base/gui/vanilla</h3>
this creates a `bionic/sdrangel:vanilla` runnable image from the GUI base image to be used on systems without any specific hardware requirements.
<h3>base/gui/linux</h3>
Linux specific host implementations
<h3>base/gui/linux/nvidia</h3>
Creates a `bionic/sdrangel:linux_nvidia` runnable image based on the base GUI image to be used on Linux systems with NVidia proprietary drivers
<h3>base/server</h3>
this creates a `bionic/sdrangel:server` runnable image from the base image to be used to run SDRangel server flavor. Essentially it compiles and installs SRangel server flavor.
<h2>Building images</h2>
Each build folder contains a `Dockerfile` to create an image and a script `build.sh` to actually build the image and tag it with its specific tag. To build an image you first `cd` to the appropriate folder.
You will proceed by running the `build.sh` script if it exists at each node in the folder hierarchy path until you reach the final image. The possible use cases corresponding to a particular path are the following:
- GUI flavor without specific hardware requirements: `base/gui/vanilla`
- GUI flavor on Linux systems with NVidia proprietary drivers: `base/gui/linux/nvidia`
- Server flavor: `base/server`
Note: for now all images are to be run in a `x86_64` environment.
<h2>Running images</h2>
Each terminal folder in the path hierarchy corresponds to a runnable image and therefore contains a `run.sh` script to be executed to start a container with the corresponding image.