ARG REGISTRY_URL

FROM ${REGISTRY_URL}/almalinux:9

RUN bash -e <<EOF

# Base dnf configuration.
echo 'http_caching=none' >> /etc/yum.conf
echo 'assumeyes=1' >> /etc/yum.conf
sed -i 's/best=True/best=False/g' /etc/dnf/dnf.conf
dnf install -y dnf-plugins-core
dnf config-manager --set-enabled crb

dnf install -y epel-release

echo '[goreleaser]
name=GoReleaser
baseurl=https://repo.goreleaser.com/yum/
enabled=1
gpgcheck=0' | tee /etc/yum.repos.d/goreleaser.repo

dnf --best install -y cmake \
    gcc \
    gcc-c++ \
    gdb \
    gettext \
    git \
    ninja-build \
    openssh-server \
    mariadb-server \
    mariadb \
    mariadb-connector-c-devel \
    gnutls-devel \
    libgcrypt-devel \
    lua-devel \
    make \
    perl-ExtUtils-Embed.noarch \
    python3 \
    python3-pip \
    perl-Thread-Queue \
    rrdtool-devel \
    selinux-policy-devel \
    yum-utils \
    perl-interpreter \
    procps-ng \
    zstd \
    nfpm \
    openssl-devel \
    libssh2-devel \
    libcurl-devel \
    zlib-devel \
    sudo

git clone --depth 1 -b 2024.01.12 https://github.com/Microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.sh
mkdir /src

EOF

COPY vcpkg.json /src
COPY overlays /overlays
COPY custom-triplets /custom-triplets

RUN bash -e <<EOF

export VCPKG_ROOT=/vcpkg
export PATH=\$VCPKG_ROOT:\$PATH

/vcpkg/vcpkg install --overlay-triplets=custom-triplets --triplet x64-linux-release --vcpkg-root vcpkg --x-wait-for-lock --x-manifest-root=/src --x-install-root=vcpkg_installed --overlay-ports=overlays

EOF

WORKDIR /src
