FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential cmake git \
    libsctp-dev lksctp-tools \
    iproute2 iputils-ping \
    && rm -rf /var/lib/apt/lists/*

RUN git config --global http.sslVerify false \
    && git clone --depth 1 https://github.com/aligungr/UERANSIM /ueransim \
    && cmake -S /ueransim -B /ueransim/build -DCMAKE_BUILD_TYPE=Release \
    && cmake --build /ueransim/build --parallel $(nproc) \
    && cp /ueransim/build/nr-gnb /usr/local/bin/ \
    && cp /ueransim/build/nr-ue /usr/local/bin/ \
    && rm -rf /ueransim

COPY config/run-test.sh /run-test.sh
RUN chmod +x /run-test.sh

ENTRYPOINT ["/bin/bash", "/run-test.sh"]
