FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get -y install build-essential cmake curl git libxml2-dev make python3 libeigen3-dev libxml2-utils mpich

WORKDIR /tmp

RUN curl -LsO https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && \
    apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && \
    rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && \
    echo "deb https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list && \
    apt-get update && \
    apt-get -y install intel-oneapi-mkl-devel
ENV MKLROOT "/opt/intel/oneapi/mkl/latest"
ENV LD_LIBRARY_PATH "${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}${MKLROOT}/lib/intel64"

RUN curl -LsO https://github.com/GlobalArrays/ga/releases/download/v5.8.1/ga-5.8.1.tar.gz && \
    tar -xzf ga-5.8.1.tar.gz && cd ga-5.8.1 && \
    ./configure --prefix=/usr --with-sockets MPICC=mpicc MPICXX=mpicxx --disable-f77 --without-blas --without-lapack --without-scalapack && \
    make && make install && \
    cd /tmp && rm -rf ga-5.8.1.tar.gz ga-5.8.1