ARG REGISTRY_URL

FROM ${REGISTRY_URL}/almalinux:8

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 powertools
dnf install -y epel-release

#################################
# install and configure mariadb #
#################################

curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup \
  | bash -s -- --os-type=rhel --skip-maxscale --skip-check-installed --os-version=8 --mariadb-server-version="mariadb-10.11"

dnf install --best -y \
    dsniff \
    gcc \
    gcc-c++ \
    gdb \
    git \
    lua \
    mariadb-server \
    mariadb \
    openssh-server \
    python3.11 \
    python3-devel \
    python3.11-pip \
    perl-interpreter \
    procps-ng \
    psmisc \
    perl-HTTP-Daemon-SSL \
    perl-JSON \
    python3-setuptools \
    rrdtool \
    tcpdump \
    sudo \
    zstd

echo "install robot and dependencies"
pip3.11 install -U setuptools wheel
pip3.11 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil
pip3.11 install grpcio grpcio_tools py-cpuinfo cython gitpython boto3 robotframework-requests PyJWT

cd /tmp/collect

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

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

dnf clean all

EOF
