ARG REGISTRY_URL

FROM ${REGISTRY_URL}/almalinux:9

RUN --mount=type=bind,src=.,dst=/tmp/collect bash -e <<EOF

# Base dnf configuration
sed -i 's/best=True/best=False/g' /etc/dnf/dnf.conf
echo 'install_weak_deps=False' >> /etc/dnf/dnf.conf

dnf install -y dnf-plugins-core
dnf config-manager --set-enabled crb
dnf install -y epel-release


#we force mysql8.4 install
dnf install -y wget
wget https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm
# add mysql 8.4 repo
rpm -ivh mysql84-community-release-el9-1.noarch.rpm
#disable native mysql package from platform vendor
yum module -y disable mysql

dnf install --best -y \
    gcc \
    gcc-c++ \
    git \
    gnutls \
    iproute \
    libgcrypt \
    lua \
    mariadb-connector-c \
    mysql-server \
    mysql \
    openssh-server \
    python3 \
    python3-devel \
    python3-pip \
    perl-interpreter \
    procps-ng \
    psmisc \
    perl-HTTP-Daemon-SSL \
    perl-JSON \
    perl-Thread-Queue \
    rrdtool \
    sudo \
    tcpdump \
    zstd

dnf clean all

echo "install robot and dependencies"

pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil
pip3 install grpcio grpcio_tools py-cpuinfo cython gitpython boto3 robotframework-requests cryptography PyJWT

cd /tmp/collect

.github/scripts/collect-prepare-test-robot.sh mysql

dnf remove -y gcc gcc-c++ python3-devel

dnf clean all

EOF
