Commit ee467bbe authored by Richard Zamora's avatar Richard Zamora

Adding example Dockerfile for testing components of the EXAALT build

parent b95d7505
FROM ubuntu:latest
#==============================================================================#
#
# This "Dockerfile" can be used by to build the EXAALT framework starting from
# a generic "ubuntu" image. Parts of this script can be used to prepare an
# image with only the EXAALT dependencies (for use in a gitlab-ci.yml script).
# Note that this script does not do a recusrive clone of the entire exaalt
# framework, because it is intended to allow some commands to be removed so that
# distinct parts of the framework can be tested independently.
#
# Original Author: Richard J. Zamora, April 26th 2017
#
# Last Modified: April 27th 2017
#
# Use Instructions:
#
# (1) Install Docker (https://www.docker.com/get-docker)
# --> For Mac, (https://www.docker.com/docker-mac)
#
# (2) Modify this Dockerfile script (and name it "Dockerfile")
# --> Set the "USERNAME" and "PASSWORD" environment variables to match
# your personal gitlab.com account
#
# (3) In a new directory containing the "Dockerfile", build an image:
# --> $ docker build -t <image-name> .
#
# Note: <image-name> is your choice (ex: ubuntu-exaalt)
#
# Note: At LANL, may need to use the following command instead:
#
# --> $ docker build --build-arg http_proxy=$http_proxy
# --build-arg https_proxy=$https_proxy -t <image-name> .
#
# --> $ docker image ls
#
# (*) To build and push an image to gitlab.com for "CI":
# --> $ docker login registry.gitlab.com
#
# --> Then, for following use:
# <full-image-name> = registry.gitlab.com/project-path/<image-name>
#
# --> $ docker build --build-arg http_proxy=$http_proxy
# --build-arg https_proxy=$https_proxy -t <full-image-name> .
#
# Note: For example, the commands preceeding the clone of LATTE can be
# used to create an image of ubuntu with EXAALT dependencies.
# The image can then be used in the ".gitlab-ci.yml" file in the
# exaalt/exaalt/ project to perform tests on a "runner". In this
# case you would use...
#
# <full-image-name> =
# registry.gitlab.com/exaalt/exaalt/<image-name>
#
# --> $ docker image ls
#
# Note: Look at the hash "tag" for this image
#
# --> $ docker tag <tag-id> <full-image-name>:<tag-name>
#
# Note: <tag-name> can be some label of choice, ex: "latest"
#
# --> $ docker push <full-image-name>
#
#==============================================================================#
# Install basic ubuntu functionality:
RUN apt-get update \
&& apt-get --yes install gfortran libblas-dev liblapack-dev \
&& apt-get --yes install cmake python gcc cmake-data g++ git wget \
&& apt-get --yes install pkg-config python-numpy python3-numpy libopenmpi-dev
# Setup environemnt:
ENV HOME /usr/local/
WORKDIR /usr/local/
# USERNAME: Gitlab.com username
# PASSWORD: Gitlab.com password
# local_PREFIX: "Local" directory containing dependencies
# super_PREFIX: Directory where apt-get installs boost
ENV USERNAME <your-gitlab-username>
ENV PASSWORD <your-gitlab-password>
ENV local_PREFIX /usr/local/
ENV super_PREFIX /usr/
# Install boost:
RUN apt-get --yes install libboost-all-dev
# Clone exaalt_deps repository:
# ...(Note: I created a public repo to hold the deps for now)
RUN git clone https://rjzamora@gitlab.com/rjzamora/exaalt_deps.git
# Install bdb:
RUN cd ${HOME}/exaalt_deps/ \
&& tar -xvf db-6.2.23.tar \
&& cd ${HOME}/exaalt_deps/db-6.2.23 \
&& cd build_unix \
&& ../dist/configure --enable-stl --enable-cxx --prefix=${local_PREFIX} \
&& make \
&& make install
# Install eigen:
RUN cd ${HOME}/exaalt_deps/eigen-eigen-26667be4f70b \
&& cp -r Eigen ${local_PREFIX}/include/.
# Install nauty:
RUN cd ${HOME}/exaalt_deps/ \
&& tar -xvf nauty26r7.tar \
&& cd ${HOME}/exaalt_deps/nauty26r7 \
&& ./configure --prefix=${local_PREFIX} \
&& make \
&& cp nauty.a ${local_PREFIX}/lib/libnauty.a \
&& mkdir ${local_PREFIX}/include/nauty \
&& cp *.h ${local_PREFIX}/include/nauty
# Build and Install latte:
RUN git clone https://github.com/lanl/LATTE.git \
&& cd ${HOME}/LATTE \
&& cp ./makefiles/makefile.CHOICES.gfort.lapack.lmp makefile.CHOICES \
&& make
ENV latte_PATH ${HOME}/LATTE
## Build and Install lammps:
RUN git clone https://${USERNAME}:${PASSWORD}@gitlab.com/exaalt/lammps.git \
&& cd ${HOME}/lammps \
&& git checkout exaalt \
&& git pull origin exaalt \
&& cd ${HOME}/lammps/lib/latte \
&& cp Makefile.lammps.gfortran Makefile.lammps \
&& cd ${HOME}/lammps/src \
&& make yes-latte \
&& make yes-molecule \
&& make yes-manybody \
&& make yes-kspace \
&& make yes-snap \
&& make yes-misc \
&& cp MAKE/MACHINES/Makefile.ubuntu_simple MAKE/Makefile.mpi \
&& make mpi \
&& make mpi mode=lib \
&& cp ${HOME}/lammps/src/liblammps_mpi.a ${local_PREFIX}/lib/. \
&& mkdir ${local_PREFIX}/include/lammps \
&& cp ${HOME}/lammps/src/*.h ${local_PREFIX}/include/lammps/.
## Clone parsplice:
RUN git clone https://${USERNAME}:${PASSWORD}@gitlab.com/exaalt/parsplice.git \
&& cd ${HOME}/parsplice \
&& git checkout exaalt \
&& git pull origin exaalt
## Build parsplice:
RUN cd ${HOME}/parsplice \
&& mkdir build \
&& cd build \
&& export COMPILER="mpic++" \
&& export bldir_PREFIX=${HOME}/parsplice/build/ \
&& cmake \
-DCMAKE_INCLUDE_PATH=${local_PREFIX}/include/:${super_PREFIX}/include/ \
-DCMAKE_BINARY_DIR=${bldir_PREFIX} \
-DEXTRA_FLAGS="-I${latte_PATH}/src" \
-DEXTRA_LINK_FLAGS="-fopenmp ${latte_PATH}/src/latte_c_bind.o ${latte_PATH}/liblatte.a -lgfortran -llapack -lblas" \
-DCMAKE_LIBRARY_PATH=${local_PREFIX}/lib:${super_PREFIX}/lib/ \
-DCMAKE_CXX_COMPILER=${COMPILER} ../ \
&& make
ENV HOME /root
CMD ["/bin/bash"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment