Two unrelated pre-existing compile failures surfaced on a fresh build (both from unpinned `ADD <git-url>` sources drifting against current Debian's GCC/Boost): - Debian's libboost-all-dev is missing #include <utility> in awaitable.hpp, which current GCC/libstdc++ no longer pulls in transitively, breaking UHD's C++20-coroutine-mode rpclib build with "'exchange' is not a member of 'std'". Patched the header directly. - SoapyUHD pins itself to C++14 and is missing a lexical_cast include in two files; current UHD's public headers need C++17 (std::optional). Bumped SoapyUHD's CMAKE_CXX_STANDARD to 17 and added the missing #include <boost/lexical_cast.hpp> in both files. Also split the single-stage Dockerfile (which kept the entire build toolchain - build-essential, cmake, doxygen, libboost-all-dev, python3-dev/numpy/scipy, plus every /tmp/sources/* source and build tree - in the final image) into a builder stage and a minimal final stage that only installs real runtime packages (derived via `ldd` on every compiled binary/module, not guessed) and COPYs over the compiled artifacts. Verified: SSH, sdrplay_apiService, and all three SoapySDR modules (remote/sdrplay/uhd) load correctly; signal handling still exits 143 on docker stop. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NiNnj78HGx1KWyCCo39HSz
144 lines
6.0 KiB
Docker
144 lines
6.0 KiB
Docker
# syntax=docker/dockerfile:1
|
|
FROM jayfield/debian-baseimage AS build_base
|
|
|
|
# ----------------------------------------------------------------------------------------------------------------------------------------
|
|
RUN apt-get update && \
|
|
apt-get -y install --no-install-recommends \
|
|
autoconf automake build-essential ccache cmake cpufrequtils doxygen ethtool \
|
|
g++ git inetutils-tools libboost-all-dev libncurses5 libncurses5-dev libusb-1.0-0 libusb-1.0-0-dev \
|
|
libusb-dev python3-dev python3-mako python3-numpy python3-requests python3-scipy python3-setuptools \
|
|
python3-ruamel.yaml \
|
|
gpsd gpsd-clients \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Debian's libboost-all-dev is missing an #include <utility> in awaitable.hpp that current
|
|
# GCC/libstdc++ no longer pulls in transitively, breaking any C++20-coroutine-mode compile
|
|
# (e.g. UHD's rpclib) with "'exchange' is not a member of 'std'". Patch it in until Debian's
|
|
# packaged Boost picks up the upstream fix.
|
|
RUN sed -i '/#define BOOST_ASIO_AWAITABLE_HPP/a #include <utility>' /usr/include/boost/asio/awaitable.hpp
|
|
|
|
# ----------------------------------------------------------------------------------------------------------------------------------------
|
|
# Build from sources
|
|
# ----------------------------------------------------------------------------------------------------------------------------------------
|
|
FROM build_base AS build
|
|
RUN apt-get update && \
|
|
apt-get -y install --no-install-recommends openssh-server udev libavahi-common-dev libavahi-core-dev libavahi-client-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# SoapySDR
|
|
ADD https://github.com/pothosware/SoapySDR.git /tmp/sources/SoapySDR
|
|
WORKDIR /tmp/sources/SoapySDR/build
|
|
RUN cmake ../
|
|
RUN make -j$(nproc)
|
|
RUN make install -j$(nproc)
|
|
RUN ldconfig
|
|
RUN SoapySDRUtil --info
|
|
|
|
# SoapyRemote
|
|
ADD https://github.com/pothosware/SoapyRemote.git /tmp/sources/SoapyRemote
|
|
WORKDIR /tmp/sources/SoapyRemote/build
|
|
RUN cmake -DENABLE_AVAHI=ON ..
|
|
RUN make -j$(nproc)
|
|
RUN make install -j$(nproc)
|
|
RUN ldconfig
|
|
|
|
# UHD
|
|
ADD https://github.com/EttusResearch/uhd.git /tmp/sources/uhd
|
|
WORKDIR /tmp/sources/uhd/host/build
|
|
RUN cmake \
|
|
-DENABLE_PYTHON_API=OFF \
|
|
-DENABLE_EXAMPLES=OFF \
|
|
-DENABLE_TESTS=OFF \
|
|
-DENABLE_E320=OFF \
|
|
-DENABLE_E300=OFF \
|
|
-DINSTALL_UDEV_RULES=OFF \
|
|
..
|
|
RUN make -j$(nproc)
|
|
RUN make test
|
|
RUN make install
|
|
RUN ldconfig
|
|
RUN /usr/local/bin/uhd_images_downloader -t usrp1
|
|
RUN /usr/local/bin/uhd_images_downloader -t b2xx
|
|
|
|
# SoapyUHD
|
|
ADD https://github.com/pothosware/SoapyUHD.git /tmp/sources/SoapyUHD
|
|
# SoapyUHDDevice.cpp and UHDSoapyDevice.cpp both use boost::lexical_cast without including it
|
|
# directly, relying on a transitive include from a UHD header that no longer provides it.
|
|
RUN sed -i '/#include <cctype>/i #include <boost/lexical_cast.hpp>' /tmp/sources/SoapyUHD/SoapyUHDDevice.cpp
|
|
RUN sed -i '/#include <boost\/weak_ptr.hpp>/a #include <boost/lexical_cast.hpp>' /tmp/sources/SoapyUHD/UHDSoapyDevice.cpp
|
|
# SoapyUHD pins itself to C++14, but current UHD's public headers (e.g. rfnoc/register_iface.hpp)
|
|
# use std::optional, which needs C++17+. Bump the standard it's built with to match.
|
|
RUN sed -i 's/set(CMAKE_CXX_STANDARD 14)/set(CMAKE_CXX_STANDARD 17)/' /tmp/sources/SoapyUHD/CMakeLists.txt
|
|
WORKDIR /tmp/sources/SoapyUHD/build
|
|
RUN cmake ../
|
|
RUN make -j$(nproc)
|
|
RUN make install -j$(nproc)
|
|
RUN ldconfig
|
|
ENV UHD_MODULE_PATH=/usr/local/lib/uhd/modules
|
|
|
|
# SDRPlay API
|
|
WORKDIR /tmp/sources
|
|
COPY bin/SDRplay_RSP_API-Linux-3.15.2.run /tmp/sources/
|
|
RUN chmod +x SDRplay_RSP_API-Linux-3.15.2.run
|
|
RUN ./SDRplay_RSP_API-Linux-3.15.2.run --noexec --target sdrplay_api
|
|
WORKDIR ./sdrplay_api
|
|
COPY bin/install_lib.patch .
|
|
RUN patch install_lib.sh install_lib.patch
|
|
RUN ./install_lib.sh
|
|
|
|
# SoapySDRPlay
|
|
ADD https://github.com/pothosware/SoapySDRPlay.git /tmp/sources/SoapySDRPlay
|
|
WORKDIR /tmp/sources/SoapySDRPlay/build
|
|
RUN cmake ../
|
|
RUN make -j$(nproc)
|
|
RUN make install -j$(nproc)
|
|
RUN ldconfig
|
|
|
|
# ----------------------------------------------------------------------------------------------------------------------------------------
|
|
# Minimal runtime image: everything above is a full build toolchain (compilers, cmake,
|
|
# -dev packages, full source trees under /tmp/sources) that's only needed to produce the
|
|
# compiled artifacts, not to run them. Only the actual runtime pieces get copied out below.
|
|
# ----------------------------------------------------------------------------------------------------------------------------------------
|
|
FROM jayfield/debian-baseimage AS final
|
|
|
|
# Runtime-only equivalents of build_base's/build's -dev packages, derived by `ldd`-ing every
|
|
# compiled binary/module in the build stage and mapping the non-/usr/local .so's back to the
|
|
# packages that own them (see git history for the exact command). Anything not listed here
|
|
# comes in automatically as a transitive apt dependency of these.
|
|
RUN apt-get update && \
|
|
apt-get -y install --no-install-recommends \
|
|
openssh-server gpsd gpsd-clients \
|
|
libavahi-client3 libusb-1.0-0 \
|
|
libboost-chrono1.74.0 libboost-program-options1.74.0 libboost-serialization1.74.0 libboost-thread1.74.0 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN useradd -m jens -p jens -s /usr/bin/bash
|
|
RUN echo jens:change_me | chpasswd
|
|
RUN echo root:root4me | chpasswd
|
|
|
|
WORKDIR /home/jens
|
|
RUN touch .Xauthority
|
|
|
|
# Compiled libraries/binaries (SoapySDR, SoapyRemote, UHD + its downloaded FPGA images,
|
|
# SoapyUHD, SoapySDRPlay) and the SDRplay API service + its udev rules for device recognition.
|
|
COPY --from=build /usr/local /usr/local
|
|
COPY --from=build /opt/sdrplay_api /opt/sdrplay_api
|
|
COPY --from=build /etc/udev/rules.d/66-sdrplay.rules /etc/udev/rules.d/66-sdrplay.rules
|
|
COPY --from=build /etc/udev/hwdb.d/20-sdrplay.hwdb /etc/udev/hwdb.d/20-sdrplay.hwdb
|
|
RUN ldconfig
|
|
ENV UHD_MODULE_PATH=/usr/local/lib/uhd/modules
|
|
|
|
# Copy scripts and configs
|
|
ENV SCRIPTS_HOME=/opt/scripts
|
|
ENV PATH=${PATH}:${SCRIPTS_HOME}
|
|
ADD scripts ${SCRIPTS_HOME}
|
|
COPY config/sshd_config /etc/ssh/
|
|
|
|
# Ports
|
|
EXPOSE 55132
|
|
EXPOSE 10022
|
|
EXPOSE 10022
|
|
|
|
# Start server
|
|
ENTRYPOINT ["/opt/scripts/server_start.sh", "/opt/scripts/server.sh"]
|