-
Notifications
You must be signed in to change notification settings - Fork 135
/
Dockerfile
116 lines (99 loc) · 3.38 KB
/
Dockerfile
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
# build container
FROM debian:bookworm-slim AS build
# install build dependencies
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
libmp3lame-dev \
libshout3-dev \
libconfig++-dev \
libfftw3-dev \
libsoapysdr-dev \
libpulse-dev \
\
git \
ca-certificates \
libusb-1.0-0-dev \
debhelper \
pkg-config \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# set working dir for compiling dependencies
WORKDIR /build_dependencies
# compile / install rtl-sdr-blog version of rtl-sdr for v4 support
RUN git clone https://github.com/rtlsdrblog/rtl-sdr-blog && \
cd rtl-sdr-blog/ && \
dpkg-buildpackage -b --no-sign && \
cd .. && \
dpkg -i librtlsdr0_*.deb && \
dpkg -i librtlsdr-dev_*.deb && \
dpkg -i rtl-sdr_*.deb
# compile / install libmirisdr-4
RUN git clone https://github.com/f4exb/libmirisdr-4 && \
cd libmirisdr-4 && \
mkdir build && \
cd build && \
cmake ../ && \
VERBOSE=1 make install && \
ldconfig
# TODO: build anything from source?
# set working dir for project build
WORKDIR /rtl_airband_build
# copy in the rtl_airband source
# WARNING: not copying in the whole repo, this may need to be updated if build files are added outside of src/
COPY ./.git/ .git/
COPY ./src/ src/
COPY ./scripts/ scripts/
COPY ./CMakeLists.txt .
# configure and build
# TODO: detect platforms
RUN uname -m && \
echo | gcc -### -v -E - | tee compiler_native_info.txt && \
cmake -B build_dir -DPLATFORM=generic -DCMAKE_BUILD_TYPE=Release -DNFM=TRUE -DBUILD_UNITTESTS=TRUE && \
VERBOSE=1 cmake --build build_dir -j4
# make sure unit tests pass
RUN ./build_dir/src/unittests
# application container
FROM debian:bookworm-slim
# install runtime dependencies
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
tini \
libc6 \
libmp3lame0 \
libshout3 \
libconfig++9v5 \
libfftw3-single3 \
libsoapysdr0.8 \
libpulse0 \
libusb-1.0-0-dev \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# install (from build container) rtl-sdr-blog version of rtl-sdr for v4 support
COPY --from=build /build_dependencies/librtlsdr0_*.deb /build_dependencies/librtlsdr-dev_*.deb /build_dependencies/rtl-sdr_*.deb /tmp/
RUN dpkg -i /tmp/librtlsdr0_*.deb && \
dpkg -i /tmp/librtlsdr-dev_*.deb && \
dpkg -i /tmp/rtl-sdr_*.deb && \
rm -rf /tmp/*.deb && \
echo '' | tee --append /etc/modprobe.d/rtl_sdr.conf && \
echo 'blacklist dvb_usb_rtl28xxun' | tee --append /etc/modprobe.d/rtl_sdr.conf && \
echo 'blacklist rtl2832' | tee --append /etc/modprobe.d/rtl_sdr.conf && \
echo 'blacklist rtl2830' | tee --append /etc/modprobe.d/rtl_sdr.conf
# copy (from build container) libmirisdr-4 library
COPY --from=build /usr/local/lib/libmirisdr.so.4 /usr/local/lib/
# Copy rtl_airband from the build container
COPY LICENSE /app/
COPY --from=build /rtl_airband_build/build_dir/src/unittests /app/
COPY --from=build /rtl_airband_build/build_dir/src/rtl_airband /app/
RUN chmod a+x /app/unittests /app/rtl_airband
# make sure unit tests pass
RUN /app/unittests
# Use tini as init and run rtl_airband from /app/
ENTRYPOINT ["/usr/bin/tini", "--"]
WORKDIR /app/
CMD ["/app/rtl_airband", "-F", "-e", "-c", "/app/rtl_airband.conf"]