FROM fedora:34

# note: at variance with centos7, here we have to explicitly install gcc
RUN yum -y update \
 && yum -y group install "Development Tools" \
 && yum -y install gcc-c++ \
 && yum -y install environment-modules gawk vim wget \
                   lapack-devel blas-devel zlib-devel gsl-devel fftw-devel openmpi-devel boost-devel \
                   python3 python3-devel python3-pip \
 && pip3 install numpy \
 && pip3 install cython numpy pandas mdtraj \
 && pip3 install MDAnalysis

RUN useradd -ms /bin/bash plumed
USER plumed
WORKDIR /home/plumed

# import plumed code.
# assumes a file plumed2.tgz is present in the Dockerfile directory
COPY plumed2.tgz /home/plumed

# build and test plumed (no install)
# FC is needed on gfortran 10 to pass regression tests
RUN . /etc/bashrc \
 && module load mpi \
 && export OMPI_MCA_btl_base_warn_component_unused=0 \
 && export MPIEXEC="mpirun --oversubscribe" \
 && export PATH=$HOME/opt/bin:$PATH \
 && export CPATH=$HOME/opt/include:$CPATH \
 && export INCLUDE=$HOME/opt/include:$INCLUDE \
 && export LIBRARY_PATH=$HOME/opt/lib:$LIBRARY_PATH \
 && export LD_LIBRARY_PATH=$HOME/opt/lib:$LD_LIBRARY_PATH \
 && export FC="gfortran -fallow-argument-mismatch" \
 && tar xzf plumed2.tgz \
 && cd plumed2 \
 && export PYTHONPATH=$PWD/python:$PYTHONPATH \
 && export PYTHON_BIN=python3 \
 && ./configure --enable-modules=all --enable-boost_serialization \
 && make -j 4 \
 && make check

