Skip to content

Commit

Permalink
Per #521, consistency of Dockerfiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed Apr 19, 2024
1 parent 6dd5b74 commit 24b998a
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 164 deletions.
100 changes: 37 additions & 63 deletions internal/scripts/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,42 @@ FROM centos:7
MAINTAINER Tatiana Burek <[email protected]>

#
# This Dockerfile checks out METviewer from GitHub and builds the specified branch or tag.
# This Dockerfile checks out METviewer and its dependencies from GitHub and builds the specified branch or tag.
# Use the develop branches for dependencies by default but override with "--build-arg".
#
ENV METVIEWER_GIT_NAME v6.0.0-beta2
ENV METCALCPY_GIT_NAME v3.0.0-beta2
ENV METPLOTPY_GIT_NAME v3.0.0-beta2
ENV METDATAIO_GIT_NAME v3.0.0-beta2

#
# Constants
#
ENV TOMCAT_MINOR_VERSION 5.61
ENV TOMCAT_MAJOR_VERSION 8
ENV TOMCAT_VERSION ${TOMCAT_MAJOR_VERSION}.${TOMCAT_MINOR_VERSION}

ENV METVIEWER_GIT_URL https://github.com/dtcenter/METviewer
ENV METCALCPY_GIT_URL https://github.com/dtcenter/METcalcpy
ENV METPLOTPY_GIT_URL https://github.com/dtcenter/METplotpy
ENV METDATAIO_GIT_URL https://github.com/dtcenter/METdataio
ARG METVIEWER_GIT_NAME
ARG METPLOTPY_GIT_NAME=develop
ARG METCALCPY_GIT_NAME=develop
ARG METDATAIO_GIT_NAME=develop

#
# METVIEWER_GIT_NAME is required.
#
RUN if [ "x${METVIEWER_GIT_NAME}" = "x" ]; then \
echo "ERROR: METVIEWER_GIT_NAME undefined! Rebuild with \"--build-arg METVIEWER_GIT_NAME={branch, tag, or hash}\""; \
exit 1; \
else \
echo "Build Argument METVIEWER_GIT_NAME=${METVIEWER_GIT_NAME}"; \
fi
fi

#
# METCALCPY_GIT_NAME is required.
#
RUN if [ "x${METCALCPY_GIT_NAME}" = "x" ]; then \
echo "ERROR: METCALCPY_GIT_NAME undefined! Rebuild with \"--build-arg METCALCPY_GIT_NAME={branch, tag, or hash}\""; \
exit 1; \
else \
echo "Build Argument METCALCPY_GIT_NAME=${METCALCPY_GIT_NAME}"; \
fi
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}"

#
# METPLOTPY_GIT_NAME is required.
# Repository URLs
#
RUN if [ "x${METPLOTPY_GIT_NAME}" = "x" ]; then \
echo "ERROR: METPLOTPY_GIT_NAME undefined! Rebuild with \"--build-arg METPLOTPY_GIT_NAME={branch, tag, or hash}\""; \
exit 1; \
else \
echo "Build Argument METPLOTPY_GIT_NAME=${METPLOTPY_GIT_NAME}"; \
fi
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

#
# METDATAIO_GIT_NAME is required.
# Constants
#
RUN if [ "x${METDATAIO_GIT_NAME}" = "x" ]; then \
echo "ERROR: METDATAIO_GIT_NAME undefined! Rebuild with \"--build-arg METDATAIO_GIT_NAME={branch, tag, or hash}\""; \
exit 1; \
else \
echo "Build Argument METDATAIO_GIT_NAME=${METDATAIO_GIT_NAME}"; \
fi
ENV TOMCAT_MINOR_VERSION 5.61
ENV TOMCAT_MAJOR_VERSION 8
ENV TOMCAT_VERSION ${TOMCAT_MAJOR_VERSION}.${TOMCAT_MINOR_VERSION}

#
# Install system updates
Expand Down Expand Up @@ -123,17 +101,14 @@ RUN mkdir /METviewer-python \
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}" \
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}


#
# Install METviewer
#
Expand Down Expand Up @@ -221,7 +196,7 @@ 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
# Install GEOS - needed for cartopy
#
WORKDIR /tmp
RUN wget http://download.osgeo.org/geos/geos-3.7.2.tar.bz2
Expand Down Expand Up @@ -268,31 +243,30 @@ RUN pip install cartopy \
&& pip install python-dateutil==2.8.2 \
&& pip install opencv-python \
&& pip install pandas==1.5.2
#
#



#
# set env vars
# Set env vars
#
ENV PYTHONPATH "${PYTHONPATH}:/METviewer-python/METcalcpy/:/METviewer-python/METplotpy/"
ENV METPLOTPY_BASE "/METviewer-python/METplotpy/"

# remove unneeded scripts
#
# 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
&& 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
#
# 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

&& 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
CMD ["true"]
Expand Down
63 changes: 34 additions & 29 deletions internal/scripts/docker/Dockerfile.copy
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ FROM centos:7
MAINTAINER Tatiana Burek <[email protected]>

#
# This Dockerfile checks out the METviewer dependencies from GitHub
# and builds the local version of the METviewer code.
# This Dockerfile checks out the METviewer dependencies from GitHub and builds the local METviewer repository.
# Use the develop branches for dependencies by default but override with "--build-arg".
#

ARG SOURCE_BRANCH
ARG METPLOTPY_GIT_NAME=develop
ARG METCALCPY_GIT_NAME=develop
ARG METDATAIO_GIT_NAME=develop

#
# SOURCE_BRANCH is not defined when built via DockerHub.
# SOURCE_BRANCH is required to define the branch of the local METviewer repository.
#
ARG SOURCE_BRANCH
RUN if [ "x${SOURCE_BRANCH}" = "x" ]; then \
echo "ERROR: SOURCE_BRANCH undefined! Rebuild with \"--build-arg SOURCE_BRANCH={branch name}\""; \
exit 1; \
Expand All @@ -19,22 +23,19 @@ RUN if [ "x${SOURCE_BRANCH}" = "x" ]; then \
fi
ENV METVIEWER_GIT_NAME ${SOURCE_BRANCH}

#
# Use the develop branch for METviewer dependencies by default.
# Use "--build-arg" options to override.
#
ENV METPLOTPY_GIT_URL https://github.com/dtcenter/METplotpy
ENV METPLOTPY_GIT_NAME develop
ENV METCALCPY_GIT_URL https://github.com/dtcenter/METcalcpy
ENV METCALCPY_GIT_NAME develop
ENV METDATAIO_GIT_URL https://github.com/dtcenter/METdataio
ENV METDATAIO_GIT_NAME develop

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
#
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
#
Expand Down Expand Up @@ -112,15 +113,15 @@ WORKDIR /METviewer-python/
RUN git clone --branch ${METDATAIO_GIT_NAME} ${METDATAIO_GIT_URL}

#
# Copy in the local version of the METviewer code
# Copy in the local METviewer repository
#
RUN echo "Copying METviewer into /METviewer" \
&& mkdir -p /METviewer

COPY . /METviewer

RUN if [ ! -e "/METviewer/build.xml" ]; then \
echo "ERROR: docker build must be run from the METviewer directory"; \
echo "ERROR: docker build must be run from the top-level METviewer directory"; \
exit 1; \
fi

Expand Down Expand Up @@ -206,7 +207,7 @@ 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
# Install GEOS - needed for cartopy
#
WORKDIR /tmp
RUN wget http://download.osgeo.org/geos/geos-3.7.2.tar.bz2
Expand Down Expand Up @@ -255,24 +256,28 @@ RUN pip install cartopy \
&& pip install pandas==1.5.2

#
# set env vars
# Set env vars
#
ENV PYTHONPATH "${PYTHONPATH}:/METviewer-python/METcalcpy/:/METviewer-python/METplotpy/"
ENV METPLOTPY_BASE "/METviewer-python/METplotpy/"

# remove unneeded scripts
#
# 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
&& 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
#
# 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
&& 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
CMD ["true"]
Expand Down
Loading

0 comments on commit 24b998a

Please sign in to comment.