Skip to content

Commit

Permalink
Merge pull request #10 from dtcenter/feature_3_debian_py310
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored Feb 9, 2023
2 parents ecf04af + 4869987 commit 85e873b
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 4 deletions.
72 changes: 72 additions & 0 deletions Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
ARG DEBIAN_VERSION=10
FROM debian:${DEBIAN_VERSION}-slim
MAINTAINER George McCabe <[email protected]>

#
# Define the compilers.
#
ENV CC /usr/bin/gcc
ENV CXX /usr/bin/g++
ENV FC /usr/bin/gfortran
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

#
# Setup the environment for interactive bash shell.
# Set soft limit to unlimited to prevent GRIB2 seg faults
#
RUN echo export MET_BASE=/usr/local/share/met >> /root/.bashrc \
&& echo export MET_FONT_DIR=/usr/local/share/met/fonts >> /root/.bashrc \
&& echo export RSCRIPTS_BASE=/usr/local/share/met/Rscripts >> /root/.bashrc \
&& echo ulimit -S -s unlimited >> /root/.bashrc

ENV MET_FONT_DIR /usr/local/share/met/fonts

# Install required system tools
RUN apt update && apt -y upgrade \
&& apt install -y build-essential gfortran wget unzip curl imagemagick \
libcurl4-gnutls-dev m4 git automake flex bison libjpeg-dev libpixman-1-dev \
emacs less \
libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev \
libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev

#
# Install Python
# https://linuxhint.com/install-python-debian-10/
#
RUN wget https://www.python.org/ftp/python/${PYTHON_VER}/Python-${PYTHON_VER}.tgz \
&& tar xzf Python-${PYTHON_VER}.tgz \
&& cd Python-${PYTHON_VER} \
&& ./configure --enable-optimizations --enable-shared LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib" \
&& make -j `nproc` \
&& make install \
&& python3 -m pip install --upgrade pip \
&& python3 -m pip install numpy xarray netCDF4

RUN echo "Downloading GhostScript fonts from ${GSFONT_URL} into /usr/local/share/met" \
&& mkdir -p /usr/local/share/met \
&& curl -SL ${GSFONT_URL} | tar zxC /usr/local/share/met

# Fix rules for ghostscript files in convert
# See: https://en.linuxportal.info/tutorials/troubleshooting/how-to-fix-errors-from-imagemagick-imagick-conversion-system-security-policy
#
RUN sed -i 's/policy domain="coder" rights="none" pattern="PS/policy domain="coder" rights="read | write" pattern="PS/g' /etc/ImageMagick-6/policy.xml \
&& sed -i 's/policy domain="coder" rights="none" pattern="EPS"/policy domain="coder" rights="read | write" pattern="EPS"/g' /etc/ImageMagick-6/policy.xml \
&& sed -i 's/policy domain="coder" rights="none" pattern="PDF"/policy domain="coder" rights="read | write" pattern="PDF"/g' /etc/ImageMagick-6/policy.xml \
&& sed -i 's/policy domain="coder" rights="none" pattern="XPS"/policy domain="coder" rights="read | write" pattern="XPS"/g' /etc/ImageMagick-6/policy.xml

#
# Set the working directory.
#
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=yes \
&& chmod +x compile_MET_all.sh \
&& ./compile_MET_all.sh development.docker
26 changes: 26 additions & 0 deletions Dockerfile.debian_unit_test_env
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ARG MET_BASE_TAG

FROM dtcenter/met-base:${MET_BASE_TAG}

MAINTAINER John Halley Gotway <[email protected]>

#
# Set the working directory.
#
WORKDIR /met

#
# Download and install MET and GhostScript fonts.
# Delete the MET source code for tagged releases matching "v"*.
#
RUN echo "Installing tools needed for running MET unit tests..." \
&& echo "Installing Perl XML Parser..." \
&& apt install -y libxml-parser-perl \
&& echo "Installing R..." \
&& apt install -y r-base \
&& echo "Installing R ncdf4 1.21..." \
&& wget https://cran.r-project.org/src/contrib/ncdf4_1.21.tar.gz \
&& R CMD INSTALL --configure-args="--with-nc-config=/usr/local/netcdf/netcdf-c-4.7.4/nc-config" ncdf4_1.21.tar.gz \
&& echo "Installing NCO and netcdf-bin (for ncdiff)..." \
&& apt install -y nco netcdf-bin \
&& echo "Finished installing unit test tools"
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,45 @@ This repository contains Dockerfiles which define environments for building and

Please see the [MET website](https://dtcenter.org/community-code/model-evaluation-tools-met) and the [MET User's Guide](https://met.readthedocs.io/en/latest) for more information. Support for the METplus components, including this repository, is provided through the [METplus Discussions](https://github.com/dtcenter/METplus/discussions) forum. Users are welcome and encouraged to answer or address each other's questions there! For more information, please read "[Welcome to the METplus Components Discussions](https://github.com/dtcenter/METplus/discussions/939)".

Version History
===============

v2.0_debian10
-------------

* Uses debian:10-slim as base image
* Python 3.10.4

v1.1
----

* Update NetCDF libraries to support groups (needed for ioda2nc enhancements)
* Update versions of HDF5 and NetCDF libraries to mirror WCOSS2

v1.0
----

* Initial release
* Uses centos:7 as base image

How to Use Dockerfiles
======================

GitHub actions are triggered for each new tag created in this repository to automatically build images from these Dockerfiles and push them to DockerHub repositories. These images form the basis of additional Dockerfiles in the other METplus component repositories for their compilation and/or testing.

1. `Dockerfile` defines the base compilation environment for MET. Tagged versions are available in the [dtcenter/met-base](https://hub.docker.com/repository/docker/dtcenter/met-base) DockerHub repository. It can be built manually by running:
```
docker build -t dtcenter/met-base .
docker build -t dtcenter/met-base:v2.0_debian10 -f Dockerfile.debian .
docker push dtcenter/met-base:v2.0_debian10
```

2. `Dockerfile.unit_test_env` extends the `dtcenter/met-base` image by adding packages required for running the MET unit tests. Tagged versions are available in the [dtcenter/met-base-unit-test](https://hub.docker.com/repository/docker/dtcenter/met-base-unit-test) DockerHub repository. It can be built manually by running:
```
docker build -t dtcenter/met-base-unit-test \
--build-arg MET_BASE_TAG=${MET_BASE_TAG} \
-f Dockerfile.unit_test_env .
export MET_BASE_TAG=v2.0_debian10
docker build -t dtcenter/met-base-unit-test:v2.0_debian10 \
--build-arg MET_BASE_TAG \
-f Dockerfile.debian_unit_test_env .
docker push dtcenter/met-base-unit-test:v2.0_debian10
```

where:
Expand Down

0 comments on commit 85e873b

Please sign in to comment.