From 251987de2914ccc8017f06ba54a94af7e5d0fe98 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Tue, 7 Nov 2023 10:14:40 -0700 Subject: [PATCH 1/6] Per #15, install yaml Python package --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 346d116..a57161a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -78,4 +78,5 @@ RUN wget https://www.python.org/ftp/python/${PYTHON_VER}/Python-${PYTHON_VER}.tg && python3 -m pip install ${BLDOPTS} xarray \ && export HDF5_DIR=/usr/local/ \ && export NETCDF4_DIR=/usr/local/ \ - && python3 -m pip install ${BLDOPTS} netCDF4 + && python3 -m pip install ${BLDOPTS} netCDF4 \ + && python3 -m pip install ${BLDOPTS} yaml From ca8d3254c5e34352616e597c43b1f8391026ee63 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Tue, 7 Nov 2023 10:31:38 -0700 Subject: [PATCH 2/6] Per #15, using bash redirection syntax --- .github/jobs/bash_functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/jobs/bash_functions.sh b/.github/jobs/bash_functions.sh index 5205753..0e98ec1 100755 --- a/.github/jobs/bash_functions.sh +++ b/.github/jobs/bash_functions.sh @@ -13,7 +13,7 @@ function time_command { error=$? else echo "Logging to ${CMD_LOGFILE}" - "$@" &>> $CMD_LOGFILE + "$@" >> $CMD_LOGFILE 2>&1 error=$? unset CMD_LOGFILE fi From ccf57c845c26a256da7c2d86e9e82e4b3805f6e5 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Tue, 7 Nov 2023 10:32:16 -0700 Subject: [PATCH 3/6] Per #15, just adding comments to indicate required environment variable inputs. --- .github/jobs/build_docker_image.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/jobs/build_docker_image.sh b/.github/jobs/build_docker_image.sh index dd973a5..fd36a15 100755 --- a/.github/jobs/build_docker_image.sh +++ b/.github/jobs/build_docker_image.sh @@ -1,6 +1,13 @@ #! /bin/bash + source ${GITHUB_WORKSPACE}/.github/jobs/bash_functions.sh +# Required environment variables: +# $GITHUB_WORKSPACE is the full path to METbaseimage. +# $GITHUB_TAG is the tag name (e.g. vX.Y). +# $DOCKERHUB_BASE_REPO is dtcenter/met-base. +# $DOCKERHUB_UNIT_TEST_REPO is dtcenter/met-base-unit-test. + MET_BASE_TAG=${GITHUB_TAG} DOCKERHUB_TAG_BASE=${DOCKERHUB_BASE_REPO}:${MET_BASE_TAG} From e18d712e96108225fbe3cf83fd3544862c8e5f73 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Tue, 7 Nov 2023 11:48:27 -0700 Subject: [PATCH 4/6] Per #15, correct name of Python package as pyyaml. --- Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a57161a..e362e6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -73,10 +73,15 @@ RUN wget https://www.python.org/ftp/python/${PYTHON_VER}/Python-${PYTHON_VER}.tg && make install \ && ln -s /usr/local/bin/python3 /usr/local/bin/python \ && BLDOPTS="--force-reinstall --global-option=build_ext --global-option=\"-R/usr/local/lib\" --global-option=\"-L/usr/local/lib\"" \ - && python3 -m pip install --upgrade pip \ - && python3 -m pip install ${BLDOPTS} numpy \ + && python3 -m pip install --upgrade pip + +# +# Install required Python packages +# +RUN python3 -m pip install ${BLDOPTS} numpy \ && python3 -m pip install ${BLDOPTS} xarray \ && export HDF5_DIR=/usr/local/ \ && export NETCDF4_DIR=/usr/local/ \ && python3 -m pip install ${BLDOPTS} netCDF4 \ - && python3 -m pip install ${BLDOPTS} yaml + && python3 -m pip install ${BLDOPTS} pyyaml + From e0da9b3386bb884e75ff9279a06ab1d1c6b44e05 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Wed, 8 Nov 2023 16:52:14 -0700 Subject: [PATCH 5/6] Per #15, updates to Dockerfile to get it building again. The problem was that installing the Python NumPy package without specifying a specific version number. The fix is adding specifing Python package version numbers and also removing the --force-reinstall build option. This version does actually build. However, we still get a warning message about --global-option being deprecated. --- Dockerfile | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index e362e6f..a5fbd54 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ ENV F77 /usr/bin/gfortran ENV PYTHON_VER 3.10.4 -ENV GSFONT_URL https://dtcenter.ucar.edu/dfiles/code/METplus/MET/docker_data/ghostscript-fonts-std-8.11.tar.gz +ENV GSFONT_URL https://dtcenter.ucar.edu/dfiles/code/METplus/MET/docker_data/ghostscript-fonts-std-8.11.tar.gz # # Set up the environment for interactive bash shell @@ -54,14 +54,6 @@ RUN sed -i 's/policy domain="coder" rights="none" pattern="PS/policy domain="cod # WORKDIR /met -RUN wget https://dtcenter.ucar.edu/dfiles/code/METplus/MET/installation/tar_files.tgz \ - && wget https://raw.githubusercontent.com/dtcenter/MET/develop/internal/scripts/installation/compile_MET_all.sh \ - && wget https://raw.githubusercontent.com/dtcenter/MET/develop/internal/scripts/environment/development.docker \ - && tar -zxf tar_files.tgz \ - && export SKIP_MET=TRUE \ - && chmod +x compile_MET_all.sh \ - && ./compile_MET_all.sh development.docker - # # Install Python from source # @@ -71,17 +63,29 @@ RUN wget https://www.python.org/ftp/python/${PYTHON_VER}/Python-${PYTHON_VER}.tg && ./configure --enable-optimizations --enable-shared LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib" \ && make -j `nproc` \ && make install \ - && ln -s /usr/local/bin/python3 /usr/local/bin/python \ - && BLDOPTS="--force-reinstall --global-option=build_ext --global-option=\"-R/usr/local/lib\" --global-option=\"-L/usr/local/lib\"" \ - && python3 -m pip install --upgrade pip + && ln -s /usr/local/bin/python3 /usr/local/bin/python + +# +# Compile the MET libraries +# +ARG MET_COMPILE_SCRIPT_BRANCH=develop +RUN echo "Pulling compilation script from MET branch ${MET_COMPILE_SCRIPT_BRANCH}" \ + && wget https://dtcenter.ucar.edu/dfiles/code/METplus/MET/installation/tar_files.tgz \ + && wget https://raw.githubusercontent.com/dtcenter/MET/${MET_COMPILE_SCRIPT_BRANCH}/internal/scripts/installation/compile_MET_all.sh \ + && wget https://raw.githubusercontent.com/dtcenter/MET/${MET_COMPILE_SCRIPT_BRANCH}/internal/scripts/environment/development.docker \ + && tar -zxf tar_files.tgz \ + && export SKIP_MET=TRUE \ + && chmod +x compile_MET_all.sh \ + && ./compile_MET_all.sh development.docker # # Install required Python packages # -RUN python3 -m pip install ${BLDOPTS} numpy \ - && python3 -m pip install ${BLDOPTS} xarray \ +RUN BLDOPTS="--global-option=build_ext --global-option=\"-R/usr/local/lib\" --global-option=\"-L/usr/local/lib\"" \ + && python3 -m pip install --upgrade pip \ + && python3 -m pip install ${BLDOPTS} numpy==1.24.2 \ + && python3 -m pip install ${BLDOPTS} xarray==2023.1.0 \ && export HDF5_DIR=/usr/local/ \ && export NETCDF4_DIR=/usr/local/ \ - && python3 -m pip install ${BLDOPTS} netCDF4 \ - && python3 -m pip install ${BLDOPTS} pyyaml - + && python3 -m pip install ${BLDOPTS} netCDF4==1.6.2 \ + && python3 -m pip install ${BLDOPTS} pyyaml>=6.0 From cf0a2f08359f92998a5fed3651f2f84607774ba1 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Thu, 9 Nov 2023 15:38:45 -0700 Subject: [PATCH 6/6] Per #15, listed explicit pyyaml version as ==6.0.1 instead of >=6.0 which inexpicably just create an output file named '=6.0'. Must be the wrong syntax. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a5fbd54..989aaf9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -88,4 +88,4 @@ RUN BLDOPTS="--global-option=build_ext --global-option=\"-R/usr/local/lib\" --gl && export HDF5_DIR=/usr/local/ \ && export NETCDF4_DIR=/usr/local/ \ && python3 -m pip install ${BLDOPTS} netCDF4==1.6.2 \ - && python3 -m pip install ${BLDOPTS} pyyaml>=6.0 + && python3 -m pip install ${BLDOPTS} pyyaml==6.0.1