Skip to content

Instantly share code, notes, and snippets.

@bekozi
Last active November 14, 2018 20:33
Show Gist options
  • Save bekozi/983c49d91b7e2325a64e48271c77c1aa to your computer and use it in GitHub Desktop.
Save bekozi/983c49d91b7e2325a64e48271c77c1aa to your computer and use it in GitHub Desktop.
Dockerfile for building ESMF in a root conda environment. Commented code allows for a custom environment and testing as needed.
FROM condaforge/linux-anvil
ENV PATH /opt/conda/bin:${PATH}
#RUN conda create -y -n dev-esmf gcc nose esmpy
RUN conda install -y gcc nose esmpy
#ENV PATH /opt/conda/envs/dev-esmf/bin:${PATH}
#ENV CONDA_DEFAULT_ENV dev-esmf
#ENV CONDA_PREFIX /opt/conda/envs/dev-esmf
RUN conda remove -y esmf esmpy
WORKDIR /opt
RUN git clone https://git.code.sf.net/p/esmf/esmf esmf
WORKDIR esmf
RUN echo "cache bust 1"
RUN git checkout merge-esmpy-inmemweights
#RUN git pull
#ENV PREFIX=/opt/conda/envs/dev-esmf
ENV PREFIX=/opt/conda
ENV ESMF_DIR=/opt/esmf
ENV ESMF_COMM=mpich3
ENV ESMF_NETCDF="split"
ENV ESMF_NETCDF_INCLUDE=${PREFIX}/include
ENV ESMF_NETCDF_LIBPATH=${PREFIX}/lib
ENV ESMF_INSTALL_PREFIX=${PREFIX}
ENV ESMF_INSTALL_BINDIR=${PREFIX}/bin
ENV ESMF_INSTALL_DOCDIR=${PREFIX}/doc
ENV ESMF_INSTALL_HEADERDIR=${PREFIX}/include
ENV ESMF_INSTALL_LIBDIR=${PREFIX}/lib
ENV ESMF_INSTALL_MODDIR=${PREFIX}/mod
RUN make info 2>&1 | tee esmf-make-info.out
RUN make 2>&1 | tee esmf-make.out
#RUN make check 2>&1 | tee esmf-make-check.out
RUN make install 2>&1 | tee esmf-make-install.out
RUN echo "cache bust 1"
#ENV ESMFMKFILE=/opt/esmf/lib/libO/Linux.gfortran.64.mpich3.default/esmf.mk
WORKDIR ${ESMF_DIR}/src/addon/ESMPy
RUN ESMFMKFILE="$(find /opt/esmf/lib -name '*esmf.mk')" && echo "ESMFMKFILE=${ESMFMKFILE}" && \
python setup.py build --ESMFMKFILE=${ESMFMKFILE}
RUN python setup.py test
RUN python setup.py install
RUN python -c "import ESMF; print(ESMF.__file__)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment