-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile.rtlsdr
55 lines (53 loc) · 1.65 KB
/
Dockerfile.rtlsdr
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
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base
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 rtl-sdr
TEMP_PACKAGES+=(build-essential) && \
TEMP_PACKAGES+=(cmake) && \
TEMP_PACKAGES+=(pkg-config) && \
# dependencies for rtl-sdr
TEMP_PACKAGES+=(libusb-1.0-0-dev) && \
KEPT_PACKAGES+=(libusb-1.0-0) && \
# install packages
apt-get update && \
apt-get install -y --no-install-recommends \
"${KEPT_PACKAGES[@]}" \
"${TEMP_PACKAGES[@]}" \
&& \
# rtlsdr: get latest release tag without cloning repo
#BRANCH_RTLSDR=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' 'git://git.osmocom.org/rtl-sdr' | grep -v '\^' | cut -d '/' -f 3 | grep -v '^v.*' | tail -1) && \
# rtlsdr: clone repo
git clone \
--branch master \
--depth 1 \
--single-branch \
https://gitea.osmocom.org/sdr/rtl-sdr.git \
# 'https://github.com/rtlsdrblog/rtl-sdr-blog.git' \
/src/rtl-sdr \
&& \
# prepare to build
mkdir -p /src/rtl-sdr/build && \
pushd /src/rtl-sdr/build && \
git rev-parse HEAD > /CONTAINER_VERSION && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DDETACH_KERNEL_DRIVER=ON \
-DINSTALL_UDEV_RULES=ON \
../ \
&& \
# build
make -j "$(nproc)" && \
# install
make install && \
ldconfig && \
popd && \
# 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