From 7bfea71ef990e02ef2857430a3fa52de89efaa78 Mon Sep 17 00:00:00 2001 From: Soren Rasmussen Date: Fri, 19 Jul 2024 09:31:41 -0600 Subject: [PATCH] Installing OpenMPI, fixing ENV and LABEL warnings, splitting some commands into multiple RUN statements for quicker debugging by making the failing step easier to find Installing ccmake in cmake-curses-gui fixes some CMake issues that were occurring, unsure why. Changing venv install location, old one wasn't working. Python packages needed to be updated. Switching to parallel builds. Make sure python package f90nml can be found in paths --- docker/Dockerfile | 69 ++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 7d0586090..85ad4d856 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,5 @@ FROM debian:12 -MAINTAINER Michael Kavulich +LABEL maintainer="Michael Kavulich " # Set up base OS environment @@ -7,21 +7,25 @@ RUN apt-get -y update # Get "essential" tools and libraries RUN apt-get -y install build-essential \ - && apt-get -y install cmake curl git file gfortran-12 ksh m4 python3 tcsh time wget vim \ + && apt-get -y install cmake cmake-curses-gui curl git file gfortran-12 ksh m4 python3 tcsh time wget vim emacs-nox \ && apt-get -y install libnetcdf-pnetcdf-19 libnetcdff7 libnetcdf-dev libnetcdff-dev libxml2 \ - && apt-get -y install python3-pip python3.11-venv + && apt-get -y install python3-pip python3.11-venv python3-netcdf4 \ + && apt-get -y install openmpi-bin libopenmpi-dev +RUN ln -s /usr/bin/python3 /usr/bin/python -MAINTAINER Grant Firl or Michael Kavulich +# Set up python needed packages, preferred Docker method is apt-get but +# f90nml can't be installed for debian that way +RUN pip install f90nml --break-system-packages #Compiler environment variables -ENV CC /usr/bin/gcc -ENV FC /usr/bin/gfortran -ENV CXX /usr/bin/g++ -ENV F77 /usr/bin/gfortran -ENV F90 /usr/bin/gfortran +ENV CC=/usr/bin/gcc +ENV FC=/usr/bin/gfortran +ENV CXX=/usr/bin/g++ +ENV F77=/usr/bin/gfortran +ENV F90=/usr/bin/gfortran # Other necessary environment variables -ENV LD_LIBRARY_PATH /usr/lib/ +ENV LD_LIBRARY_PATH=/usr/lib/ # Set up unpriviledged user account, set up user home space and make sure user has permissions on all stuff in /comsoftware RUN groupadd comusers -g 9999 \ @@ -32,57 +36,54 @@ RUN groupadd comusers -g 9999 \ && chown -R comuser:comusers /comsoftware \ && chmod -R 6755 /comsoftware -# Link version-specific aliases (python3 will be created later with virtual environment) -RUN ln -s ~comuser/.venv/bin/python3 /usr/local/bin/python -RUN ln -s /usr/bin/gfortran-12 /usr/bin/gfortran - # all root steps completed above, now continue below as regular userID comuser USER comuser WORKDIR /home # Build NCEP libraries we need for SCM -ENV NCEPLIBS_DIR /comsoftware/nceplibs +ENV NCEPLIBS_DIR=/comsoftware/nceplibs RUN mkdir -p $NCEPLIBS_DIR/src && cd $NCEPLIBS_DIR/src \ && git clone -b v2.4.1 --recursive https://github.com/NOAA-EMC/NCEPLIBS-bacio \ && mkdir NCEPLIBS-bacio/build && cd NCEPLIBS-bacio/build \ && cmake -DCMAKE_INSTALL_PREFIX=$NCEPLIBS_DIR .. \ - && make VERBOSE=1 \ - && make install + && make VERBOSE=1 -j \ + && make install RUN cd $NCEPLIBS_DIR/src \ && git clone -b v2.3.3 --recursive https://github.com/NOAA-EMC/NCEPLIBS-sp \ && mkdir NCEPLIBS-sp/build && cd NCEPLIBS-sp/build \ && cmake -DCMAKE_INSTALL_PREFIX=$NCEPLIBS_DIR .. \ - && make VERBOSE=1 \ + && make VERBOSE=1 -j \ && make install RUN cd $NCEPLIBS_DIR/src \ && git clone -b v2.11.0 --recursive https://github.com/NOAA-EMC/NCEPLIBS-w3emc \ && mkdir NCEPLIBS-w3emc/build && cd NCEPLIBS-w3emc/build \ && cmake -DCMAKE_INSTALL_PREFIX=$NCEPLIBS_DIR .. \ - && make VERBOSE=1 \ + && make VERBOSE=1 -j \ && make install -ENV bacio_ROOT /comsoftware/nceplibs -ENV sp_ROOT /comsoftware/nceplibs -ENV w3emc_ROOT /comsoftware/nceplibs +ENV bacio_ROOT=/comsoftware/nceplibs +ENV sp_ROOT=/comsoftware/nceplibs +ENV w3emc_ROOT=/comsoftware/nceplibs -# Obtain CCPP SCM source code and static data, build code +# Obtain CCPP SCM source code, build code, and download static data RUN cd /comsoftware \ && git clone --recursive -b main https://github.com/NCAR/ccpp-scm \ - && cd /comsoftware/ccpp-scm/ \ - && ./contrib/get_all_static_data.sh \ - && ./contrib/get_thompson_tables.sh \ - && cd /comsoftware/ccpp-scm/scm \ - && mkdir bin \ - && cd bin \ + && mkdir /comsoftware/ccpp-scm/scm/bin + +RUN cd /comsoftware/ccpp-scm/scm/bin \ && cmake ../src \ - && make -j4 + && make -j + +RUN cd /comsoftware/ccpp-scm/ \ + && ./contrib/get_all_static_data.sh \ + && ./contrib/get_thompson_tables.sh # The analysis scripts have options for using LaTeX when making figure labels. -# If you would like to install LaTeK, uncomment the section below. +# If you would like to install LaTeK, uncomment the section below. # Note: This will increase the image size by 1 GB. #USER root #RUN yum -y update \ @@ -96,9 +97,3 @@ ENV SCM_ROOT=/comsoftware/ccpp-scm/ # For interactive use, vim mouse settings are infuriating RUN echo "set mouse=" > ~/.vimrc - -# Set up python virtual environment and install needed packages -ENV VIRTUAL_ENV=~/.venv -RUN python3 -m venv $VIRTUAL_ENV -ENV PATH="$VIRTUAL_ENV/bin:$PATH" -RUN pip3 install f90nml==1.4.4 netcdf4==1.6.5