ARG UBUNTU_VERSION="23.04"
FROM ubuntu:${UBUNTU_VERSION}

# Build environment
# Profiling and analyzer tools
RUN apt-get -y update \
    && DEBIAN_FRONTEND=noninteractive TZ=Europe/Berlin apt-get -y install tzdata apt-utils \
    && apt-get -y upgrade \
    && apt-get -y install python3 python3-pip lsb-release software-properties-common \
       rename wget git ninja-build make gdb gdbserver pkg-config \
       gperf linux-tools-generic linux-tools-common valgrind \
    && apt-get clean

# CMake
ENV CMAKE_VERSION="3.28.0-rc2"
RUN wget -P /opt https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh \
    && bash /opt/cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr \
    && rm /opt/cmake-${CMAKE_VERSION}-linux-x86_64.sh

# Conan
ENV CONAN_VERSION="1.61.0"
ARG UBUNTU_VERSION
SHELL ["/bin/bash", "-c"]
RUN env; if [[ ${UBUNTU_VERSION} == "23.04" || ${UBUNTU_VERSION} == "23.10" ]]; then \
    pip3 install --break-system-packages conan==${CONAN_VERSION}; else \
    pip3 install conan==${CONAN_VERSION}; fi

ARG GCC_VERSION="13"
RUN apt-get -y install gcc-${GCC_VERSION} g++-${GCC_VERSION}