radiosonde_auto_rx/Dockerfile

141 wiersze
3.8 KiB
Docker
Czysty Zwykły widok Historia

2019-10-17 10:00:15 +00:00
# -------------------
# The build container
# -------------------
2024-09-07 09:48:29 +00:00
FROM debian:bookworm-slim AS build
2019-10-17 10:00:15 +00:00
2021-02-19 16:53:11 +00:00
# Upgrade base packages.
2019-10-17 10:00:15 +00:00
RUN apt-get update && \
apt-get upgrade -y && \
2021-07-19 04:08:51 +00:00
apt-get install -y --no-install-recommends \
2024-09-07 09:48:35 +00:00
autoconf \
automake \
build-essential \
2021-07-03 13:39:38 +00:00
cmake \
git \
libatlas-base-dev \
2022-07-09 03:41:29 +00:00
libsamplerate0-dev \
libusb-1.0-0-dev \
2024-09-07 09:48:35 +00:00
ninja-build \
pkg-config \
python3 \
python3-dev \
python3-pip \
2021-07-22 13:28:09 +00:00
python3-setuptools \
python3-wheel \
libavahi-client-dev \
libbsd-dev \
libfftw3-dev \
libiniparser-dev \
libopus-dev && \
2019-10-17 10:00:15 +00:00
rm -rf /var/lib/apt/lists/*
2024-09-11 16:17:01 +00:00
# Copy in existing wheels.
COPY wheel[s]/ /root/.cache/pip/wheels/
# No wheels might exist.
RUN mkdir -p /root/.cache/pip/wheels/
2021-02-19 16:53:11 +00:00
# Copy in requirements.txt.
COPY auto_rx/requirements.txt \
/root/radiosonde_auto_rx/auto_rx/requirements.txt
2021-02-19 16:53:11 +00:00
# Install Python packages.
2024-09-07 09:48:29 +00:00
RUN pip3 install \
--user --break-system-packages --no-warn-script-location --ignore-installed \
2021-02-19 16:53:11 +00:00
-r /root/radiosonde_auto_rx/auto_rx/requirements.txt
2022-09-23 07:13:57 +00:00
# Compile rtl-sdr from source.
RUN git clone https://github.com/steve-m/librtlsdr.git /root/librtlsdr && \
mkdir -p /root/librtlsdr/build && \
cd /root/librtlsdr/build && \
cmake -DCMAKE_INSTALL_PREFIX=/root/target/usr/local -Wno-dev ../ && \
make && \
make install && \
rm -rf /root/librtlsdr
2022-09-23 07:13:57 +00:00
# Compile spyserver_client from source.
RUN git clone https://github.com/miweber67/spyserver_client.git /root/spyserver_client && \
cd /root/spyserver_client && \
make
# Compile ka9q-radio from source
RUN git clone https://github.com/ka9q/ka9q-radio.git /root/ka9q-radio && \
cd /root/ka9q-radio && \
2024-12-10 15:56:30 +00:00
git checkout ff7fe26a12909317b26bdb24a0576db87c15baf2 && \
make \
-f Makefile.linux \
"COPTS=-std=gnu11 -pthread -Wall -funsafe-math-optimizations -fno-math-errno -fcx-limited-range -D_GNU_SOURCE=1" \
tune powers pcmcat
2021-02-19 16:53:11 +00:00
# Copy in radiosonde_auto_rx.
COPY . /root/radiosonde_auto_rx
2019-10-17 10:00:15 +00:00
2022-07-09 03:41:29 +00:00
# Build the radiosonde_auto_rx binaries.
2021-02-19 16:53:11 +00:00
WORKDIR /root/radiosonde_auto_rx/auto_rx
RUN /bin/sh build.sh
2019-10-17 10:00:15 +00:00
# -------------------------
# The application container
# -------------------------
2024-09-07 09:48:29 +00:00
FROM debian:bookworm-slim
2019-10-12 11:04:00 +00:00
EXPOSE 5000/tcp
2021-02-19 16:53:11 +00:00
# Upgrade base packages and install application dependencies.
2021-07-19 03:13:48 +00:00
RUN apt-get update && \
apt-get upgrade -y && \
2021-07-19 04:08:51 +00:00
apt-get install -y --no-install-recommends \
libatlas3-base \
libatomic1 \
2022-07-09 03:41:29 +00:00
libsamplerate0 \
python3 \
2019-10-12 11:04:00 +00:00
rng-tools \
sox \
2021-01-05 08:16:51 +00:00
tini \
2024-11-02 05:05:06 +00:00
libbsd0 \
avahi-utils \
libnss-mdns \
avahi-utils \
2021-07-19 03:13:48 +00:00
usbutils && \
rm -rf /var/lib/apt/lists/*
2019-10-12 11:04:00 +00:00
2021-07-03 13:39:38 +00:00
# Copy rtl-sdr from the build container.
COPY --from=build /root/target /
RUN ldconfig
2019-10-17 10:00:15 +00:00
# Copy any additional Python packages from the build container.
2021-02-19 16:53:11 +00:00
COPY --from=build /root/.local /root/.local
2019-10-17 10:00:15 +00:00
# Copy auto_rx from the build container to /opt.
2021-02-19 16:53:11 +00:00
COPY --from=build /root/radiosonde_auto_rx/LICENSE /opt/auto_rx/
COPY --from=build /root/radiosonde_auto_rx/auto_rx/ /opt/auto_rx/
2022-07-09 03:41:29 +00:00
# Copy ss_client from the build container and create links
COPY --from=build /root/spyserver_client/ss_client /opt/auto_rx/
RUN ln -s ss_client /opt/auto_rx/ss_iq && \
ln -s ss_client /opt/auto_rx/ss_power
# Copy ka9q-radio utilities
COPY --from=build /root/ka9q-radio/tune /usr/local/bin/
COPY --from=build /root/ka9q-radio/powers /usr/local/bin/
COPY --from=build /root/ka9q-radio/pcmcat /usr/local/bin/
2024-11-02 05:05:06 +00:00
# Allow mDNS resolution for ka9q-radio utilities
RUN sed -i -e 's/files dns/files mdns4_minimal [NOTFOUND=return] dns/g' /etc/nsswitch.conf
# NOTE: These volume flags must be set for avahi to talk to the local host:
# -v /var/run/dbus:/var/run/dbus
# -v /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket
2021-01-05 08:20:00 +00:00
# Set the working directory.
2019-10-12 11:04:00 +00:00
WORKDIR /opt/auto_rx
2021-01-05 08:16:51 +00:00
2021-02-19 16:53:11 +00:00
# Ensure scripts from Python packages are in PATH.
ENV PATH=/root/.local/bin:$PATH
2021-01-05 08:20:00 +00:00
# Use tini as init.
2021-01-05 08:16:51 +00:00
ENTRYPOINT ["/usr/bin/tini", "--"]
# Run auto_rx.py.
2021-02-19 16:53:11 +00:00
CMD ["python3", "/opt/auto_rx/auto_rx.py"]