11# build container
22FROM debian:bookworm-slim AS build
33
4- # set working dir
5- WORKDIR /app
6-
74# install build dependencies
85RUN apt-get update && \
96 apt-get upgrade -y && \
@@ -26,6 +23,9 @@ RUN apt-get update && \
2623 apt-get clean && \
2724 rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2825
26+ # set working dir for building rtl-sdr support
27+ WORKDIR /rtl_sdr_build
28+
2929# compile / install rtl-sdr-blog version of rtl-sdr for v4 support
3030RUN git clone https://github.com/rtlsdrblog/rtl-sdr-blog && \
3131 cd rtl-sdr-blog/ && \
@@ -38,26 +38,29 @@ RUN git clone https://github.com/rtlsdrblog/rtl-sdr-blog && \
3838
3939# TODO: build anything from source?
4040
41+ # set working dir for project build
42+ WORKDIR /rtl_airband_build
43+
4144# copy in the rtl_airband source
42- COPY CMakeLists.txt src /app/
45+ # WARNING: not copying in the whole repo, this may need to be updated if build files are added outside of src/
46+ COPY ./.git/ .git/
47+ COPY ./src/ src/
48+ COPY ./CMakeLists.txt .
4349
4450# configure and build
4551# TODO: detect platforms
4652RUN uname -m && \
47- echo | gcc -### -v -E - | tee /app/ compiler_native_info.txt && \
53+ echo | gcc -### -v -E - | tee compiler_native_info.txt && \
4854 cmake -B build_dir -DPLATFORM=generic -DCMAKE_BUILD_TYPE=Release -DNFM=TRUE -DBUILD_UNITTESTS=TRUE && \
4955 VERBOSE=1 cmake --build build_dir -j4
5056
5157# make sure unit tests pass
52- RUN ./build_dir/unittests
58+ RUN ./build_dir/src/ unittests
5359
5460
5561# application container
5662FROM debian:bookworm-slim
5763
58- # set working dir
59- WORKDIR /app
60-
6164# install runtime dependencies
6265RUN apt-get update && \
6366 apt-get upgrade -y && \
@@ -76,20 +79,20 @@ RUN apt-get update && \
7679 rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
7780
7881# install (from build container) rtl-sdr-blog version of rtl-sdr for v4 support
79- COPY --from=build /app /librtlsdr0_*.deb /app /librtlsdr-dev_*.deb /app /rtl-sdr_*.deb . /
80- RUN dpkg -i librtlsdr0_*.deb && \
81- dpkg -i librtlsdr-dev_*.deb && \
82- dpkg -i rtl-sdr_*.deb && \
83- rm -rf *.deb && \
82+ COPY --from=build /rtl_sdr_build /librtlsdr0_*.deb /rtl_sdr_build /librtlsdr-dev_*.deb /rtl_sdr_build /rtl-sdr_*.deb /tmp /
83+ RUN dpkg -i /tmp/ librtlsdr0_*.deb && \
84+ dpkg -i /tmp/ librtlsdr-dev_*.deb && \
85+ dpkg -i /tmp/ rtl-sdr_*.deb && \
86+ rm -rf /tmp/ *.deb && \
8487 echo '' | tee --append /etc/modprobe.d/rtl_sdr.conf && \
8588 echo 'blacklist dvb_usb_rtl28xxun' | tee --append /etc/modprobe.d/rtl_sdr.conf && \
8689 echo 'blacklist rtl2832' | tee --append /etc/modprobe.d/rtl_sdr.conf && \
8790 echo 'blacklist rtl2830' | tee --append /etc/modprobe.d/rtl_sdr.conf
8891
8992# Copy rtl_airband from the build container
9093COPY LICENSE /opt/rtl_airband/
91- COPY --from=build /app /build_dir/unittests /opt/rtl_airband/
92- COPY --from=build /app /build_dir/rtl_airband /opt/rtl_airband/
94+ COPY --from=build /rtl_airband_build /build_dir/src /unittests /opt/rtl_airband/
95+ COPY --from=build /rtl_airband_build /build_dir/src /rtl_airband /opt/rtl_airband/
9396RUN chmod a+x /opt/rtl_airband/unittests /opt/rtl_airband/rtl_airband
9497
9598# make sure unit tests pass
0 commit comments