# SRTLA receiver (srtla_rec) for the IRL Dashboard.
# Builds the receiver from the upstream BELABOX/srtla source — the same
# implementation the router's srtla_send bonder talks to.
#
#   docker build -t srtla-rec .
#
FROM debian:bookworm-slim AS build
RUN apt-get update \
 && apt-get install -y --no-install-recommends git build-essential ca-certificates \
 && rm -rf /var/lib/apt/lists/*
RUN git clone --depth 1 https://github.com/BELABOX/srtla /src \
 && cd /src && make

FROM debian:bookworm-slim
COPY --from=build /src/srtla_rec /usr/local/bin/srtla_rec
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Args: <listen-udp-port>  <srt-target-host>  <srt-target-port>
#   Receives the bonded SRTLA stream on <listen-udp-port>, reassembles it, and
#   forwards a clean SRT stream to <srt-target-host>:<srt-target-port>.
# The wrapper resolves the target first and refuses to start on the failure
# modes UDP cannot report — an unresolvable name, or one pointing back at this
# container. See entrypoint.sh for why that matters.
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
