1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Docker files moved to their own repository

This commit is contained in:
f4exb 2019-03-07 04:24:23 +01:00
parent 8f111b2e7b
commit 575a9f42ac
24 changed files with 0 additions and 441 deletions

View File

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

View File

@ -1,229 +0,0 @@
FROM ubuntu:18.04
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 \
&& usermod -a -G audio,dialout,plugdev sdr\
&& sudo usermod --shell /bin/bash sdr
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER sdr
# Some essentials
RUN sudo apt-get update && sudo apt-get -y install \
vim \
openssh-server \
iputils-ping \
traceroute \
iproute2 \
nmap
# Prepare buiid and install environment
RUN sudo mkdir /opt/build /opt/install \
&& sudo chown sdr:sdr /opt/build /opt/install
# Configure tzdata manually
ENV TZONE=Europe/Paris
RUN sudo ln -fs /usr/share/zoneinfo/$TZONE /etc/localtime \
&& sudo apt-get update && sudo apt-get -y install tzdata
# Install base build packages dependencies - step 1
RUN sudo apt-get update && sudo apt-get -y install \
git \
cmake \
g++ \
pkg-config \
autoconf \
automake \
libtool \
libfftw3-dev \
libusb-1.0-0-dev \
libusb-dev
# Install base build packages dependencies - Qt5
RUN sudo apt-get update && sudo apt-get -y install \
qt5-default \
qtbase5-dev \
qtchooser \
libqt5multimedia5-plugins \
qtmultimedia5-dev \
qttools5-dev \
qttools5-dev-tools \
libqt5opengl5-dev \
qtbase5-dev
# Install base build packages dependencies - Boost
RUN sudo apt-get update && sudo apt-get -y install \
libboost-all-dev
# Install base build packages dependencies - the rest
RUN sudo apt-get update && sudo apt-get -y install \
libasound2-dev \
pulseaudio \
libopencv-dev \
libxml2-dev \
bison \
flex \
ffmpeg \
libavcodec-dev \
libavformat-dev \
libopus-dev \
libavahi-client-dev
# This is the first step to allow sharing pulseaudio with the host
COPY pulse-client.conf /etc/pulse/client.conf
# CM256cc
RUN cd /opt/build \
&& git clone https://github.com/f4exb/cm256cc.git \
&& cd cm256cc \
&& git reset --hard 64beaaa \
&& mkdir build; cd build \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/cm256cc .. \
&& make -j4 install
# MBElib
RUN cd /opt/build \
&& git clone https://github.com/szechyjs/mbelib.git \
&& cd mbelib \
&& git reset --hard e2d84c1 \
&& mkdir build; cd build \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/mbelib .. \
&& make -j4 install
# SerialDV
RUN cd /opt/build \
&& git clone https://github.com/f4exb/serialDV.git \
&& cd serialDV \
&& git reset --hard 06caac6 \
&& mkdir build; cd build \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/serialdv .. \
&& make -j4 install
# DSDcc
RUN cd /opt/build \
&& git clone https://github.com/f4exb/dsdcc.git \
&& cd dsdcc \
&& git reset --hard 2a89df4 \
&& mkdir build; cd build \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/dsdcc -DUSE_MBELIB=ON -DLIBMBE_INCLUDE_DIR=/opt/install/mbelib/include -DLIBMBE_LIBRARY=/opt/install/mbelib/lib/libmbe.so -DLIBSERIALDV_INCLUDE_DIR=/opt/install/serialdv/include/serialdv -DLIBSERIALDV_LIBRARY=/opt/install/serialdv/lib/libserialdv.so .. \
&& make -j4 install
# Codec2
RUN sudo apt-get update && sudo apt-get -y install subversion \
libspeexdsp-dev \
libsamplerate0-dev
RUN cd /opt/build \
&& svn co https://svn.code.sf.net/p/freetel/code/codec2-dev@4067 codec2-dev \
&& cd codec2-dev \
&& mkdir build; cd build \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/codec2 .. \
&& make -j4 install
# Airspy
RUN cd /opt/build \
&& git clone https://github.com/airspy/host.git libairspy \
&& cd libairspy \
&& git reset --hard 5c86e53 \
&& mkdir build; cd build \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libairspy .. \
&& make -j4 install
# RTL-SDR
RUN cd /opt/build \
&& git clone https://github.com/librtlsdr/librtlsdr.git \
&& cd librtlsdr \
&& git reset --hard c7d970a \
&& mkdir build; cd build \
&& cmake -Wno-dev -DDETACH_KERNEL_DRIVER=ON -DCMAKE_INSTALL_PREFIX=/opt/install/librtlsdr .. \
&& make -j4 install
# PlutoSDR
RUN cd /opt/build \
&& git clone https://github.com/analogdevicesinc/libiio.git \
&& cd libiio \
&& git reset --hard 5bdc242 \
&& mkdir build; cd build \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libiio -DINSTALL_UDEV_RULE=OFF .. \
&& make -j4 install
# BladeRF
RUN cd /opt/build \
&& git clone https://github.com/Nuand/bladeRF.git \
&& cd bladeRF/host \
&& git reset --hard 32058c4 \
&& mkdir build; cd build \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libbladeRF -DINSTALL_UDEV_RULES=OFF .. \
&& make -j4 install
# HackRF
RUN cd /opt/build \
&& git clone https://github.com/mossmann/hackrf.git \
&& cd hackrf/host \
&& git reset --hard 9bbbbbf \
&& mkdir build; cd build \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libhackrf -DINSTALL_UDEV_RULES=OFF .. \
&& make -j4 install
# LimeSDR
RUN cd /opt/build \
&& git clone https://github.com/myriadrf/LimeSuite.git \
&& cd LimeSuite \
&& git reset --hard 59d51d5 \
&& mkdir builddir; cd builddir \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/LimeSuite .. \
&& make -j4 install
# Airspy HF
RUN cd /opt/build \
&& git clone https://github.com/airspy/airspyhf \
&& cd airspyhf \
&& git reset --hard 075b8f9 \
&& mkdir build; cd build \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libairspyhf .. \
&& make -j4 install
# Perseus
RUN sudo apt-get update && sudo apt-get -y install xxd
RUN cd /opt/build \
&& git clone https://github.com/f4exb/libperseus-sdr.git \
&& cd libperseus-sdr \
&& git checkout fixes \
&& mkdir build; cd build \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/libperseus .. \
&& make \
&& make install
# XTRX
RUN sudo apt-get update && sudo apt-get -y install python-cheetah
RUN cd /opt/build \
&& git clone https://github.com/xtrx-sdr/images.git xtrx-images \
&& cd xtrx-images \
&& git reset --hard 053ec82 \
&& git submodule init \
&& git submodule update \
&& cd sources \
&& mkdir build; cd build \
&& cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/opt/install/xtrx-images -DENABLE_SOAPY=NO .. \
&& make -j4 install
# Soapy main
RUN cd /opt/build \
&& git clone https://github.com/pothosware/SoapySDR.git \
&& cd SoapySDR \
&& git reset --hard 6d21756 \
&& mkdir build; cd build \
&& cmake -DCMAKE_INSTALL_PREFIX=/opt/install/SoapySDR .. \
&& make -j4 install
# Soapy remote
RUN cd /opt/build \
&& git clone https://github.com/pothosware/SoapyRemote.git \
&& cd SoapyRemote \
&& git reset --hard 4f5d717 \
&& 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

View File

@ -1,4 +0,0 @@
#!/bin/sh
IMAGE_NAME=sdrangel/bionic:base
docker build -t ${IMAGE_NAME} .

View File

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

View File

@ -1,14 +0,0 @@
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

@ -1,4 +0,0 @@
#!/bin/sh
IMAGE_NAME=sdrangel/bionic:gui
docker build -t ${IMAGE_NAME} .

View File

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

View File

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

View File

@ -1,16 +0,0 @@
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

@ -1,12 +0,0 @@
#!/bin/sh
IMAGE_NAME=sdrangel/bionic:linux_nvidia
NVIDIA_VER=$(nvidia-smi --query-gpu=driver_version --format=csv,noheader) #410.78
NVIDIA_DRIVER=NVIDIA-Linux-x86_64-${NVIDIA_VER}.run # path to nvidia driver
if [ ! -f ${NVIDIA_DRIVER} ]; then
wget http://us.download.nvidia.com/XFree86/Linux-x86_64/${NVIDIA_VER}/NVIDIA-Linux-x86_64-${NVIDIA_VER}.run
cp ${NVIDIA_DRIVER} NVIDIA-DRIVER.run
fi
docker build -t ${IMAGE_NAME} .

View File

@ -1,16 +0,0 @@
#!/bin/sh
COMMAND="/bin/bash"
USER_UID=$(id -u)
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 "PULSE_SERVER=unix:/run/user/1000/pulse/native" \
-e "DISPLAY=unix:0.0" \
-p 50022:22 \
-v="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
-v="/home/${USER}/.config:/home/sdr/.config:rw" \
-v="/run/user/${USER_UID}/pulse:/run/user/1000/pulse" \
sdrangel/bionic:linux_nvidia $COMMAND

View File

@ -1,6 +0,0 @@
#!/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

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

View File

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

View File

@ -1,4 +0,0 @@
#!/bin/sh
IMAGE_NAME=sdrangel/bionic:vanilla
docker build -t ${IMAGE_NAME} .

View File

@ -1,7 +0,0 @@
#!/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

@ -1,6 +0,0 @@
#!/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

@ -1,9 +0,0 @@
# Connect to the host's server using the mounted UNIX socket
default-server = unix:/run/user/1000/pulse/native
# Prevent a server running in the container
autospawn = no
daemon-binary = /bin/true
# Prevent the use of shared memory
enable-shm = false

View File

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

View File

@ -1,14 +0,0 @@
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"]

View File

@ -1,4 +0,0 @@
#!/bin/sh
IMAGE_NAME=sdrangel/bionic:server
docker build -t ${IMAGE_NAME} .

View File

@ -1,5 +0,0 @@
#!/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

View File

@ -1,6 +0,0 @@
#!/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

View File

@ -1,65 +0,0 @@
<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.