Skip to content

Commit

Permalink
Merge pull request cnerg#1 from kkiesling/pymoab-images
Browse files Browse the repository at this point in the history
build scripts w/ moab and pymoab w/ python 2 and 3
  • Loading branch information
gonuke authored Apr 9, 2020
2 parents f584ebe + 66acc6f commit ccb7ee9
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.
56 changes: 56 additions & 0 deletions pymoab-py2-18.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM ubuntu:18.04

# set timezone
ENV HOME /root
ENV TZ=America/Chicago
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

ENV HOME /root

RUN apt-get -y --force-yes update \
&& apt-get install -y --force-yes \
software-properties-common \
build-essential \
git \
cmake \
gfortran \
libblas-dev \
python-pip \
liblapack-dev \
libhdf5-dev \
autoconf \
libtool

# need to put libhdf5.so on LD_LIBRARY_PATH
ENV LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu
ENV LIBRARY_PATH /usr/lib/x86_64-linux-gnu

# upgrade pip and install python dependencies
ENV PATH $HOME/.local/bin:$PATH
RUN python -m pip install --upgrade pip \
&& pip install numpy scipy cython tables matplotlib setuptools future pytest

# make starting directory
RUN cd $HOME \
&& mkdir opt

# build MOAB
RUN cd $HOME/opt \
&& mkdir moab \
&& cd moab \
&& git clone --depth 1 -b Version5.1.0 --single-branch https://bitbucket.org/fathomteam/moab \
&& mkdir build \
&& cd build \
&& cmake ../moab -DCMAKE_C_FLAGS="-fPIC -DPIC" -DCMAKE_CXX_FLAGS="-fPIC -DPIC" -DBUILD_SHARED_LIBS=ON \
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--no-undefined" -DENABLE_MPI=OFF \
-DENABLE_HDF5=ON -DHDF5_ROOT=/usr/lib/x86_64-linux-gnu/hdf5/serial \
-DENABLE_NETCDF=OFF -DENABLE_METIS=OFF -DENABLE_IMESH=OFF -DENABLE_FBIGEOM=OFF \
-DENABLE_PYMOAB=ON -DPREFIX=$HOME/opt/moab \
&& make all -j 8 \
&& cd .. \
&& rm -rf build moab

# set environment variables
ENV PATH $HOME/opt/moab/bin/:$PATH
ENV LD_LIBRARY_PATH $HOME/opt/moab/lib:$LD_LIBRARY_PATH
ENV PYTHONPATH $HOME/opt/moab/lib/python2.7/site-packages/:$PYTHONPATH
61 changes: 61 additions & 0 deletions pymoab-py3-18.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
FROM ubuntu:18.04

# set timezone
ENV HOME /root
ENV TZ=America/Chicago
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

ENV HOME /root

RUN apt-get -y --force-yes update \
&& apt-get install -y --force-yes \
software-properties-common \
build-essential \
git \
cmake \
gfortran \
libblas-dev \
python3-pip \
liblapack-dev \
libhdf5-dev \
autoconf \
libtool

# need to put libhdf5.so on LD_LIBRARY_PATH
ENV LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu
ENV LIBRARY_PATH /usr/lib/x86_64-linux-gnu
ENV PATH $HOME/.local/bin:$PATH

# switch to python 3
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10; \
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 10;

# upgrade pip and install python dependencies
RUN python -m pip install --upgrade pip \
&& pip install numpy scipy cython tables matplotlib setuptools future pytest


# make starting directory
RUN cd $HOME \
&& mkdir opt

# build MOAB
RUN cd $HOME/opt \
&& mkdir moab \
&& cd moab \
&& git clone --depth 1 -b Version5.1.0 --single-branch https://bitbucket.org/fathomteam/moab \
&& mkdir build \
&& cd build \
&& cmake ../moab -DCMAKE_C_FLAGS="-fPIC -DPIC" -DCMAKE_CXX_FLAGS="-fPIC -DPIC" -DBUILD_SHARED_LIBS=ON \
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--no-undefined" -DENABLE_MPI=OFF \
-DENABLE_HDF5=ON -DHDF5_ROOT=/usr/lib/x86_64-linux-gnu/hdf5/serial \
-DENABLE_NETCDF=OFF -DENABLE_METIS=OFF -DENABLE_IMESH=OFF -DENABLE_FBIGEOM=OFF \
-DENABLE_PYMOAB=ON -DPREFIX=$HOME/opt/moab \
&& make all -j 8 \
&& cd .. \
&& rm -rf build moab

# set environment variables
ENV PATH $HOME/opt/moab/bin/:$PATH
ENV LD_LIBRARY_PATH $HOME/opt/moab/lib:$LD_LIBRARY_PATH
ENV PYTHONPATH $HOME/opt/moab/lib/python3.6/site-packages/:$PYTHONPATH

0 comments on commit ccb7ee9

Please sign in to comment.