-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile.readsb-full
176 lines (174 loc) · 6.83 KB
/
Dockerfile.readsb-full
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:rtlsdr
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=DL3008,SC2086,DL4006,SC2039
RUN set -x && \
TEMP_PACKAGES=() && \
KEPT_PACKAGES=() && \
# packages needed to install
TEMP_PACKAGES+=(git) && \
# packages needed to build
TEMP_PACKAGES+=(build-essential) && \
TEMP_PACKAGES+=(cmake) && \
TEMP_PACKAGES+=(pkg-config) && \
# prerequisites for bladeRF
TEMP_PACKAGES+=(libusb-1.0-0-dev) && \
KEPT_PACKAGES+=(libncurses5) && \
TEMP_PACKAGES+=(libncurses5-dev) && \
KEPT_PACKAGES+=(libtecla1) && \
TEMP_PACKAGES+=(libtecla-dev) && \
# prerequisites for libiio
TEMP_PACKAGES+=(libusb-1.0-0-dev) && \
KEPT_PACKAGES+=(libserialport0) && \
TEMP_PACKAGES+=(libserialport-dev) && \
KEPT_PACKAGES+=(libxml2) && \
TEMP_PACKAGES+=(libxml2-dev) && \
TEMP_PACKAGES+=(bison) && \
TEMP_PACKAGES+=(flex) && \
KEPT_PACKAGES+=(libcdk5nc6) && \
TEMP_PACKAGES+=(libcdk5-dev) && \
KEPT_PACKAGES+=(libaio1) && \
TEMP_PACKAGES+=(libaio-dev) && \
# prerequisites for readsb-protobuf \
KEPT_PACKAGES+=(protobuf-c-compiler) && \
KEPT_PACKAGES+=(libprotobuf-c1) && \
TEMP_PACKAGES+=(libprotobuf-c-dev) && \
TEMP_PACKAGES+=(librrd-dev) && \
KEPT_PACKAGES+=(libncurses5) && \
TEMP_PACKAGES+=(libncurses5-dev) && \
TEMP_PACKAGES+=(binutils) && \
# install packages
apt-get update && \
apt-get install -y --no-install-recommends \
"${KEPT_PACKAGES[@]}" \
"${TEMP_PACKAGES[@]}" \
&& \
# bladeRF: get latest release tag without cloning repo
BRANCH_BLADERF=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' 'https://github.com/Nuand/bladeRF.git' | grep -v '\^' | grep 'refs/tags/libbladeRF_' | cut -d '/' -f 3 | tail -1) && \
# bladeRF: clone repo
git clone \
--branch "$BRANCH_BLADERF" \
--depth 1 \
--single-branch \
'https://github.com/Nuand/bladeRF.git' \
/src/bladeRF \
&& \
# bladeRF: prepare to build
mkdir /src/bladeRF/build && \
pushd /src/bladeRF/build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DINSTALL_UDEV_RULES=ON \
../ \
&& \
# bladeRF: build & install
make -j "$(nproc)" && \
make install && \
ldconfig && \
popd && \
# bladeRF: simple test
bladeRF-cli --version && \
# libiio: get latest release tag without cloning repo
BRANCH_LIBIIO=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' 'https://github.com/analogdevicesinc/libiio.git' | grep -v '\^' | grep -v '.*-r.*' | cut -d '/' -f 3 | tail -1) && \
# libiio: clone repo
git clone \
--branch "$BRANCH_LIBIIO" \
--depth 1 \
--single-branch \
'https://github.com/analogdevicesinc/libiio.git' \
/src/libiio \
&& \
# libiio: prepare to build
mkdir /src/libiio/build && \
pushd /src/libiio/build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCSHARP_BINDINGS=OFF \
-DPYTHON_BINDINGS=OFF \
-DWITH_DOC=OFF \
-DWITH_MAN=OFF \
-DWITH_TESTS=OFF \
-DWITH_LOCAL_CONFIG=OFF \
-DWITH_HWMON=OFF \
-DENABLE_PACKAGING=OFF \
-DINSTALL_UDEV_RULE=ON \
-DHAVE_DNS_SD=OFF \
../ \
&& \
# libiio: build & install
make -j "$(nproc)" && \
make install && \
ldconfig && \
popd && \
# libad9361-iio: get latest release tag without cloning repo
BRANCH_LIBAD9361_IIO=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' 'https://github.com/analogdevicesinc/libad9361-iio.git' | grep -v '\^' | cut -d '/' -f 3 | tail -1) && \
# libad9361-iio: clone repo
git clone \
--branch "$BRANCH_LIBAD9361_IIO" \
--depth 1 \
--single-branch \
'https://github.com/analogdevicesinc/libad9361-iio.git' \
/src/libad9361-iio \
&& \
# libad9361-iio: prepare to build
mkdir /src/libad9361-iio/build && \
pushd /src/libad9361-iio/build && \
cmake -DCMAKE_BUILD_TYPE=Release ../ && \
# libad9361-iio: build & install
make -j "$(nproc)" && \
make install && \
ldconfig && \
popd && \
# readsb: get latest release tag without cloning repo
# kx1t edits -- get simply the latest committed version from the dev (=default) branch rather than the latest tag
# this is because Mictronic doesn't update their labels very often, and important bug fixes are needlessly delayed
# BRANCH_READSB=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' 'https://github.com/Mictronics/readsb-protobuf.git' | grep -v "\-dev" | cut -d '/' -f 3 | tail -1) && \
BRANCH_READSB="dev" && \
# readsb: clone repo
git clone \
--branch "$BRANCH_READSB" \
--depth 1 \
--single-branch \
'https://github.com/Mictronics/readsb-protobuf.git' \
/src/readsb-protobuf \
&& \
# readsb: build & install (note, -j seems to have issues, so not using...)
pushd /src/readsb-protobuf && \
make BLADERF=yes RTLSDR=yes PLUTOSDR=yes HAVE_BIASTEE=yes && \
find "/src/readsb-protobuf" -maxdepth 1 -executable -type f -exec cp -v {} /usr/local/bin/ \; && \
popd && \
ldconfig && \
# readsb: simple tests
readsb --version && \
viewadsb --version && \
readsbrrd --version && \
# readsb: copy webapp files to /usr/share/readsb/html
mkdir -p /usr/share/readsb/html && \
cp -Rv /src/readsb-protobuf/webapp/src/* /usr/share/readsb/html/ && \
mkdir -p /etc/lighttpd/conf-available/ && \
cp -v /src/readsb-protobuf/debian/lighttpd/* /etc/lighttpd/conf-available/ && \
# readsb: copy collectd files
mkdir -p /etc/collectd/collectd.conf.d && \
cp -v /src/readsb-protobuf/debian/collectd/readsb.collectd.conf /etc/collectd/collectd.conf.d/ && \
mkdir -p /usr/share/readsb/graphs && \
cp -v /src/readsb-protobuf/debian/graphs/*.sh /usr/share/readsb/graphs/ && \
chmod a+x /usr/share/readsb/graphs/*.sh && \
# readsb: local copy of installed readsb version's protobuf proto file
mkdir -p /opt/readsb-protobuf && \
cp -v /src/readsb-protobuf/readsb.proto /opt/readsb-protobuf/readsb.proto && \
# bladeRF: download bladeRF FPGA images
BLADERF_RBF_PATH="/usr/share/Nuand/bladeRF" && \
mkdir -p "$BLADERF_RBF_PATH" && \
curl -L -o "$BLADERF_RBF_PATH/hostedxA4.rbf" https://www.nuand.com/fpga/hostedxA4-latest.rbf && \
curl -L -o "$BLADERF_RBF_PATH/hostedxA9.rbf" https://www.nuand.com/fpga/hostedxA9-latest.rbf && \
curl -L -o "$BLADERF_RBF_PATH/hostedx40.rbf" https://www.nuand.com/fpga/hostedx40-latest.rbf && \
curl -L -o "$BLADERF_RBF_PATH/hostedx115.rbf" https://www.nuand.com/fpga/hostedx115-latest.rbf && \
curl -L -o "$BLADERF_RBF_PATH/adsbxA4.rbf" https://www.nuand.com/fpga/adsbxA4.rbf && \
curl -L -o "$BLADERF_RBF_PATH/adsbxA9.rbf" https://www.nuand.com/fpga/adsbxA9.rbf && \
curl -L -o "$BLADERF_RBF_PATH/adsbx40.rbf" https://www.nuand.com/fpga/adsbx40.rbf && \
curl -L -o "$BLADERF_RBF_PATH/adsbx115.rbf" https://www.nuand.com/fpga/adsbx115.rbf && \
# Clean up
apt-get remove -y "${TEMP_PACKAGES[@]}" && \
apt-get autoremove -q -o APT::Autoremove::RecommendsImportant=0 -o APT::Autoremove::SuggestsImportant=0 -y && \
rm -rf /src/* && \
bash /scripts/clean-build.sh