# This file is part of the mlhp project. License: See LICENSE
#
# Image used by the linux jobs in .gitlab-ci.yml. Build and publish with:
#
#   docker login registry.gitlab.com
#   docker build -t registry.gitlab.com/hpfem/code/mlhp/ubuntu22.04 tools/docker
#   docker push registry.gitlab.com/hpfem/code/mlhp/ubuntu22.04

FROM ubuntu:22.04

# Prevent tzdata from asking for the time zone during installation
ENV TZ=Europe/Berlin DEBIAN_FRONTEND=noninteractive
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# g++-10 and clang-12 are the oldest supported compilers; the newest ones are tested
# on debian instead. The unversioned gcc and g++ are what cffi and the MPI wrappers
# invoke, make is cmake's default generator, and the bindings return numpy arrays.
RUN apt-get update && apt-get install -y --no-install-recommends \
        g++-10 clang-12 gcc g++ libomp-dev \
        cmake make ninja-build git \
        python3-dev python3-pip python3-numpy \
        doxygen graphviz \
    && rm -rf /var/lib/apt/lists/*

# For the distributed branch. petsc-dev is the distribution's default build (real
# scalars, 32 bit indices) and pulls the same MPI; pkg-config finds its petsc.pc.
# Note mpirun needs --allow-run-as-root in a CI job.
RUN apt-get update && apt-get install -y --no-install-recommends \
        mpi-default-dev mpi-default-bin petsc-dev pkg-config \
    && rm -rf /var/lib/apt/lists/*
