Skip to content

Commit

Permalink
Feature #23 METviewer (#26)
Browse files Browse the repository at this point in the history
* Per #23, add Dockerfile.metviewer image and update automation to build/push it

* Per #23, update README file with info about #23

* Per #23, remove geos --enable-php configuration option that is not actually supported.

* Per #23 review README
  • Loading branch information
JohnHalleyGotway authored Jul 3, 2024
1 parent c5189c8 commit e4f6fb6
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 15 deletions.
29 changes: 20 additions & 9 deletions .github/jobs/build_docker_image.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash
#! /bin/bash

source ${GITHUB_WORKSPACE}/.github/jobs/bash_functions.sh

Expand All @@ -7,34 +7,45 @@ source ${GITHUB_WORKSPACE}/.github/jobs/bash_functions.sh
# $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.
# $DOCKERHUB_METVIEWER_REPO is dtcenter/met-base-metviewer.

MET_BASE_TAG=${GITHUB_TAG}

# Build dtcenter/met-base
DOCKERHUB_TAG_BASE=${DOCKERHUB_BASE_REPO}:${MET_BASE_TAG}

DOCKERFILE_PATH=${GITHUB_WORKSPACE}/Dockerfile

CMD_LOGFILE=${GITHUB_WORKSPACE}/docker_build_base_image.log
CMD_LOGFILE=${GITHUB_WORKSPACE}/docker_build_met_base_image.log

time_command docker build -t ${DOCKERHUB_TAG_BASE} \
-f $DOCKERFILE_PATH ${GITHUB_WORKSPACE}
if [ $? != 0 ]; then
cat ${GITHUB_WORKSPACE}/docker_build_base_image.log
cat ${GITHUB_WORKSPACE}/docker_build_met_base_image.log
exit 1
fi

# Build dtcenter/met-base-unit-test
DOCKERHUB_TAG_UNIT_TEST=${DOCKERHUB_UNIT_TEST_REPO}:${GITHUB_TAG}

DOCKERFILE_PATH=${GITHUB_WORKSPACE}/Dockerfile.unit_test_env

CMD_LOGFILE=${GITHUB_WORKSPACE}/docker_build_unit_test_env.log
CMD_LOGFILE=${GITHUB_WORKSPACE}/docker_build_met_base_unit_test_env_image.log

time_command docker build -t ${DOCKERHUB_TAG_UNIT_TEST} \
--build-arg MET_BASE_TAG=${MET_BASE_TAG} \
-f $DOCKERFILE_PATH ${GITHUB_WORKSPACE}
if [ $? != 0 ]; then
cat ${GITHUB_WORKSPACE}/docker_build_unit_test_env.log
cat ${GITHUB_WORKSPACE}/docker_build_met_base_unit_test_env_image.log
exit 1
fi

# Build dtcenter/met-base-metviewer
DOCKERHUB_TAG_METVIEWER=${DOCKERHUB_METVIEWER_REPO}:${GITHUB_TAG}
DOCKERFILE_PATH=${GITHUB_WORKSPACE}/Dockerfile.metviewer
CMD_LOGFILE=${GITHUB_WORKSPACE}/docker_build_met_base_metviewer_image.log

time_command docker build -t ${DOCKERHUB_TAG_METVIEWER} \
--build-arg MET_BASE_TAG=${MET_BASE_TAG} \
-f $DOCKERFILE_PATH ${GITHUB_WORKSPACE}
if [ $? != 0 ]; then
cat ${GITHUB_WORKSPACE}/docker_build_met_base_metviewer_image.log
exit 1
fi

20 changes: 16 additions & 4 deletions .github/jobs/push_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,32 @@
source ${GITHUB_WORKSPACE}/.github/jobs/bash_functions.sh

DOCKERHUB_TAG_BASE=${DOCKERHUB_BASE_REPO}:${GITHUB_TAG}

DOCKERHUB_TAG_UNIT_TEST=${DOCKERHUB_UNIT_TEST_REPO}:${GITHUB_TAG}

DOCKERHUB_TAG_METVIEWER=${DOCKERHUB_METVIEWER_REPO}:${GITHUB_TAG}

# skip docker push if credentials are not set
if [ -z ${DOCKER_USERNAME+x} ] || [ -z ${DOCKER_PASSWORD+x} ]; then
echo "DockerHub credentials not set. Skipping docker push"
exit 1
echo "DockerHub credentials not set. Skipping docker push"
exit 1
fi

echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin

# Push dtcenter/met-base
time_command docker push ${DOCKERHUB_TAG_BASE}
if [ $? != 0 ]; then
exit 1
fi

# Push dtcenter/met-base-unit-test
time_command docker push ${DOCKERHUB_TAG_UNIT_TEST}
if [ $? != 0 ]; then
exit 1
fi

# Push dtcenter/met-base-metviewer
time_command docker push ${DOCKERHUB_TAG_METVIEWER}
if [ $? != 0 ]; then
exit 1
fi

1 change: 1 addition & 0 deletions .github/workflows/build_and_push_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
env:
DOCKERHUB_BASE_REPO: dtcenter/met-base
DOCKERHUB_UNIT_TEST_REPO: dtcenter/met-base-unit-test
DOCKERHUB_METVIEWER_REPO: dtcenter/met-base-metviewer

jobs:

Expand Down
110 changes: 110 additions & 0 deletions Dockerfile.metviewer
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
ARG MET_BASE_TAG
FROM dtcenter/met-base:${MET_BASE_TAG}
MAINTAINER John Halley Gotway <[email protected]>

#
# Constants
#
ENV TOMCAT_MAJOR_VERSION 9
ENV TOMCAT_MINOR_VERSION 0.89
ENV TOMCAT_VERSION ${TOMCAT_MAJOR_VERSION}.${TOMCAT_MINOR_VERSION}
ENV CATALINA_HOME /opt/tomcat

#
# Install system updates
#
RUN apt -y update && apt -y upgrade

#
# Expose METviewer port
#
EXPOSE 8080

#
# Install required packages
#
RUN apt -y install ant openjdk-17-jdk r-base mariadb-server ksh

#
# Setup default cran repo
#
RUN echo "r <- getOption('repos'); r['CRAN'] <- 'http://cran.us.r-project.org'; options(repos = r);" > ~/.Rprofile

#
# Install required R packages
#
RUN Rscript -e "install.packages('boot')" \
&& Rscript -e "install.packages('plotrix')" \
&& Rscript -e "install.packages('gsl')" \
&& Rscript -e "install.packages('data.table')" \
&& Rscript -e "install.packages('verification')"

#
# Install Tomcat
#
ENV CATALINA_HOME /opt/tomcat

RUN wget https://archive.apache.org/dist/tomcat/tomcat-${TOMCAT_MAJOR_VERSION}/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz \
&& tar -xvf apache-tomcat-${TOMCAT_VERSION}.tar.gz \
&& rm apache-tomcat*.tar.gz \
&& mv apache-tomcat* ${CATALINA_HOME} \
&& chmod +x ${CATALINA_HOME}/bin/*sh

#
# Create a link for python3
#
RUN ln -sf /usr/local/bin/python3.10 /usr/bin/python3
RUN ln -sf /usr/bin/python3 /usr/bin/python

RUN ln -sf /usr/local/bin/pip3.10 /usr/bin/pip3
RUN ln -sf /usr/bin/pip3 /usr/bin/pip

#
# Install GEOS - needed for cartopy
#
WORKDIR /tmp
RUN wget http://download.osgeo.org/geos/geos-3.7.2.tar.bz2
RUN tar xjf geos-3.7.2.tar.bz2
WORKDIR /tmp/geos-3.7.2
RUN ./configure ; make clean ; make
RUN make install
RUN ldconfig
WORKDIR /tmp
RUN rm -r geos-3.7.2.tar.bz2

#
# Install Python packages
#
RUN pip install cartopy \
&& pip install eofs \
&& pip install imutils==0.5.4 \
&& pip install imageio==2.19.2 \
&& pip install lxml==4.9.1 \
&& pip install matplotlib==3.5.2 \
&& pip install netcdf4==1.6.2 \
&& pip install numpy==1.22.0 \
&& pip install pytest==7.1.2 \
&& pip install metpy==1.3.1 \
&& pip install pyyaml==6.0 \
&& pip install scikit-image==0.19.3 \
&& pip install scikit-learn \
&& pip install scipy==1.11.1 \
&& pip install xarray==2022.3.0 \
&& pip install PyMySQL==1.0.2 \
&& pip install pint==0.19.2 \
&& pip install plotly==5.9.0 \
&& pip install kaleido==0.2.1 \
&& pip install attrs==22.1.0 \
&& pip install exceptiongroup==1.0.4 \
&& pip install iniconfig==1.1.1 \
&& pip install packaging==22.0 \
&& pip install pluggy==1.0.0 \
&& pip install pytz==2022.6 \
&& pip install setuptools==65.5.1 \
&& pip install six==1.16.0 \
&& pip install tomli==2.0.1 \
&& pip install wheel==0.38.1 \
&& pip install python-dateutil==2.8.2 \
&& pip install opencv-python \
&& pip install pandas==1.5.2

2 changes: 0 additions & 2 deletions Dockerfile.unit_test_env
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
ARG MET_BASE_TAG

FROM dtcenter/met-base:${MET_BASE_TAG}

MAINTAINER John Halley Gotway <[email protected]>

#
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ v3.2

* Install SciPy Python package (#20)

UPDATE: 7/3/2024 Manually pushed the dtcenter/met-base-metviewer:v3.2 image to DockerHub to serve as the new base image for METviewer development and testing (#23)

v3.1
----

Expand Down

0 comments on commit e4f6fb6

Please sign in to comment.