-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Per #527, add build_metviewer_docker.sh script and update Dockerfile.…
…copy to call it.
- Loading branch information
1 parent
b9616bd
commit 276056c
Showing
2 changed files
with
201 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,9 @@ MAINTAINER John Halley Gotway <[email protected]> | |
# | ||
|
||
ARG SOURCE_BRANCH | ||
ARG METPLOTPY_GIT_NAME=develop | ||
ARG METCALCPY_GIT_NAME=develop | ||
ARG METDATAIO_GIT_NAME=develop | ||
ENV METPLOTPY_GIT_NAME=develop | ||
ENV METCALCPY_GIT_NAME=develop | ||
ENV METDATAIO_GIT_NAME=develop | ||
|
||
# | ||
# SOURCE_BRANCH is required to define the local METviewer repository branch name. | ||
|
@@ -25,84 +25,28 @@ RUN if [ "x${SOURCE_BRANCH}" = "x" ]; then \ | |
echo "Build Argument SOURCE_BRANCH=${SOURCE_BRANCH}"; \ | ||
fi | ||
|
||
ENV METVIEWER_GIT_URL https://github.com/dtcenter/METviewer | ||
ENV METVIEWER_GIT_NAME ${SOURCE_BRANCH} | ||
ENV CATALINA_HOME /opt/tomcat | ||
|
||
RUN echo "Build Argument METVIEWER_GIT_NAME=${METVIEWER_GIT_NAME}" \ | ||
&& echo "Build Argument METPLOTPY_GIT_NAME=${METPLOTPY_GIT_NAME}" \ | ||
&& echo "Build Argument METCALCPY_GIT_NAME=${METCALCPY_GIT_NAME}" \ | ||
&& echo "Build Argument METDATAIO_GIT_NAME=${METDATAIO_GIT_NAME}" | ||
|
||
# | ||
# Repository URLs | ||
# Expose METviewer port | ||
# | ||
ENV METVIEWER_GIT_URL https://github.com/dtcenter/METviewer | ||
ENV METPLOTPY_GIT_URL https://github.com/dtcenter/METplotpy | ||
ENV METCALCPY_GIT_URL https://github.com/dtcenter/METcalcpy | ||
ENV METDATAIO_GIT_URL https://github.com/dtcenter/METdataio | ||
|
||
# | ||
# Constants | ||
# | ||
ENV TOMCAT_MAJOR_VERSION 9 | ||
ENV TOMCAT_MINOR_VERSION 0.89 | ||
ENV TOMCAT_VERSION ${TOMCAT_MAJOR_VERSION}.${TOMCAT_MINOR_VERSION} | ||
|
||
# | ||
# Update the OS, as needed | ||
# | ||
RUN apt update \ | ||
&& apt -y upgrade | ||
|
||
# | ||
# 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 | ||
|
||
EXPOSE 8080 | ||
|
||
# | ||
# Install METplus python components | ||
# Set env vars | ||
# | ||
RUN mkdir /METviewer-python \ | ||
&& echo "Checking out METcalcpy ${METCALCPY_GIT_NAME} from ${METCALCPY_GIT_URL}" | ||
WORKDIR /METviewer-python/ | ||
RUN git clone --branch ${METCALCPY_GIT_NAME} ${METCALCPY_GIT_URL} | ||
|
||
RUN echo "Checking out METplotpy ${METPLOTPY_GIT_NAME} from ${METPLOTPY_GIT_URL}" | ||
WORKDIR /METviewer-python/ | ||
RUN git clone --branch ${METPLOTPY_GIT_NAME} ${METPLOTPY_GIT_URL} | ||
|
||
RUN echo "Checking out METdataio ${METDATAIO_GIT_NAME} from ${METDATAIO_GIT_URL}" | ||
WORKDIR /METviewer-python/ | ||
RUN git clone --branch ${METDATAIO_GIT_NAME} ${METDATAIO_GIT_URL} | ||
ENV PYTHONPATH "${PYTHONPATH}:/METviewer-python/METcalcpy/:/METviewer-python/METplotpy/" | ||
ENV METPLOTPY_BASE "/METviewer-python/METplotpy/" | ||
|
||
# | ||
# Install METviewer by copying in the local METviewer repository. | ||
# Copy in the local METviewer repository | ||
# | ||
RUN echo "Copying METviewer into /METviewer" \ | ||
&& mkdir -p /METviewer | ||
|
@@ -114,137 +58,10 @@ RUN if [ ! -e "/METviewer/build.xml" ]; then \ | |
exit 1; \ | ||
fi | ||
|
||
RUN echo "Configuring and building METviewer" \ | ||
&& cd /METviewer \ | ||
&& cat webapp/metviewer/WEB-INF/classes/build.properties | \ | ||
sed -r 's%db.host=.*%db.host=mysql_mv%g' | \ | ||
sed -r 's%db.user=.*%db.user=root%g' | \ | ||
sed -r 's%db.password=.*%db.password=mvuser%g' | \ | ||
sed -r 's%db.management.system=.*%db.management.system=mysql%g' | \ | ||
sed -r 's%output.dir=.*%output.dir=/opt/tomcat/webapps/metviewer_output/%g' | \ | ||
sed -r 's%webapps.dir=.*%webapps.dir=/opt/tomcat/webapps/metviewer/%g' | \ | ||
sed -r 's%url.output=.*%url.output=http://localhost:8080/metviewer_output/%g' | \ | ||
sed -r 's%python.env=.*%python.env=/usr/%g' | \ | ||
sed -r 's%metcalcpy.home=.*%metcalcpy.home=/METviewer-python/METcalcpy/%g' | \ | ||
sed -r 's%metplotpy.home=.*%metplotpy.home=/METviewer-python/METplotpy/%g' \ | ||
> build.properties \ | ||
&& ant -Dbuild.properties.file=./build.properties \ | ||
-Ddb.management.system=mysql \ | ||
-Dmetcalcpy.path=/METviewer-python/METcalcpy/ \ | ||
-Dmetplotpy.path=/METviewer-python/METplotpy/ \ | ||
-Dpython.env.path=/usr/ war \ | ||
&& mv /METviewer/dist/*.war ${CATALINA_HOME}/webapps \ | ||
&& echo "Configuring METviewer scripts" \ | ||
&& cd /METviewer/bin \ | ||
&& cat mv_batch.sh | \ | ||
sed -r 's%JAVA=.*%JAVA=java\nMV_HOME=/METviewer%g' | \ | ||
sed -r 's%PYTHON_ENV=.*%PYTHON_ENV=/usr%g' | \ | ||
sed -r 's%METCALCPY_HOME=.*%METCALCPY_HOME=/METviewer-python/METcalcpy/%g' | \ | ||
sed -r 's%METPLOTPY_HOME=.*%METPLOTPY_HOME=/METviewer-python/METplotpy/%g' \ | ||
> mv_batch.sh-DOCKER \ | ||
&& mv mv_batch.sh-DOCKER mv_batch.sh \ | ||
&& cat mv_load.sh | \ | ||
sed -r 's%PYTHON_ENV=.*%PYTHON_ENV=/usr%g' | \ | ||
sed -r 's%METDATAIO_HOME=.*%METDATAIO_HOME=/METviewer-python/METdataio/%g' \ | ||
> mv_load.sh-DOCKER \ | ||
&& mv mv_load.sh-DOCKER mv_load.sh \ | ||
&& cat mv_scorecard.sh | \ | ||
sed -r 's%JAVA=.*%JAVA=java\nMV_HOME=/METviewer%g' | \ | ||
sed -r 's%PYTHON_ENV=.*%PYTHON_ENV=/usr%g' | \ | ||
sed -r 's%METCALCPY_HOME=.*%METCALCPY_HOME=/METviewer-python/METcalcpy/%g' | \ | ||
sed -r 's%METPLOTPY_HOME=.*%METPLOTPY_HOME=/METviewer-python/METplotpy/%g' \ | ||
> mv_scorecard.sh-DOCKER \ | ||
&& mv mv_scorecard.sh-DOCKER mv_scorecard.sh \ | ||
&& cat mv_prune.sh | \ | ||
sed -r 's%JAVA=.*%JAVA=java\nMV_HOME=/METviewer%g' | \ | ||
sed -r 's%PYTHON_ENV=.*%PYTHON_ENV=/usr%g' | \ | ||
sed -r 's%METCALCPY_HOME=.*%METCALCPY_HOME=/METviewer-python/METcalcpy/%g' | \ | ||
sed -r 's%METPLOTPY_HOME=.*%METPLOTPY_HOME=/METviewer-python/METplotpy/%g' \ | ||
> mv_prune.sh-DOCKER \ | ||
&& mv mv_prune.sh-DOCKER mv_prune.sh | ||
|
||
# | ||
# Create a link for python3 | ||
# Run build script | ||
# | ||
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 | ||
RUN internal/scripts/docker/build_metviewer_docker.sh | ||
|
||
# | ||
# 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 --enable-php; 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 | ||
|
||
# | ||
# Set env vars | ||
# | ||
ENV PYTHONPATH "${PYTHONPATH}:/METviewer-python/METcalcpy/:/METviewer-python/METplotpy/" | ||
ENV METPLOTPY_BASE "/METviewer-python/METplotpy/" | ||
|
||
# | ||
# Remove unneeded scripts | ||
# | ||
RUN rm /METviewer/bin/auto_test.sh \ | ||
&& rm /METviewer/bin/mv_test.sh \ | ||
&& rm /METviewer/bin/nightly_test.sh \ | ||
&& rm /METviewer/bin/prep_dist.sh \ | ||
&& rm /METviewer/bin/mv_compare.sh \ | ||
&& rm -r /METviewer/test | ||
|
||
# | ||
# Change permissions of the scripts | ||
# | ||
RUN chmod 755 /METviewer/bin/mv_batch.sh \ | ||
&& chmod 755 /METviewer/bin/mv_load.sh \ | ||
&& chmod 755 /METviewer/bin/mv_prune.sh \ | ||
&& chmod 755 /METviewer/bin/mv_scorecard.sh | ||
|
||
ENTRYPOINT ${CATALINA_HOME}/bin/startup.sh && /bin/bash | ||
ENTRYPOINT ${CATALINA_HOME}/bin/startup.sh && /bin/bash | ||
CMD ["true"] | ||
|
Oops, something went wrong.