FROM debian:bookworm

ARG VERSION

ENV DEBIAN_FRONTEND=noninteractive

RUN bash -e <<EOF

apt-get update

# Install the required lib for language and apt installation. zstd is required for cache management in GHA.
# Install Robotframework and test dependency
apt-get install -y locales lsb-release libcurl4-openssl-dev curl wget gnupg2 \
apt-transport-https zstd python3 python3-dev python3-pip ca-certificates \
software-properties-common jq mariadb-client iproute2 procps lsof

localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

pip3 install --break-system-packages --no-cache-dir \
robotframework robotframework-examples robotframework-databaselibrary \
pymysql robotframework-requests robotframework-jsonlibrary

# can't use \$() method it would be executed before the main script, and lsb_release would not be installed.
lsb_release -sc | xargs -I % sh  -c 'echo deb https://packages.centreon.com/apt-standard-${VERSION}-stable/ % main' | tee /etc/apt/sources.list.d/centreon.list
lsb_release -sc | xargs -I % sh  -c 'echo deb https://packages.centreon.com/apt-plugins-stable/ % main' | tee /etc/apt/sources.list.d/centreon-plugins.list

wget -O- https://apt-key.centreon.com | gpg --dearmor | tee /etc/apt/trusted.gpg.d/centreon.gpg > /dev/null 2>&1
apt-get clean
rm -rf /var/lib/apt/lists/*

EOF


