FROM debian:bookworm-slim AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
        meson ninja-build git build-essential \
        cmake \
    && rm -rf /var/lib/apt/lists/*

#RUN pip3 install --break-system-packages meson ninja

RUN GIT_SSL_NO_VERIFY=true git clone https://github.com/moo-the-cow/librist && \
    cd librist && \
    mkdir build && \
    cd build && \
    meson .. --default-library=static --buildtype=release -Db_lto=true && \
    ninja
FROM busybox:glibc
COPY --from=builder /librist/build/tools/rist2rist /usr/bin/
#COPY --from=builder /librist/build/tools/ristreceiver /usr/bin/
#COPY --from=builder /librist/build/tools/ristsender /usr/bin/
#COPY --from=builder /librist/build/tools/ristsrppasswd /usr/bin/
COPY banner.txt /
# Create the entrypoint.sh script directly in the Dockerfile
RUN echo '#!/bin/sh' > /entrypoint.sh \
    && echo 'cat /banner.txt' >> /entrypoint.sh \
    && echo 'exec "$@"' >> /entrypoint.sh \
    && chmod +x /entrypoint.sh

# Set the entrypoint to the created script
ENTRYPOINT ["/entrypoint.sh"]