From 5db7758e8e3c0a6d31dd590ab71123024f28e425 Mon Sep 17 00:00:00 2001 From: John Halley Gotway Date: Mon, 8 Jul 2024 12:17:14 -0600 Subject: [PATCH] Feature #527 met_base_image (#538) * Per #527, try switching to met-base image * Per 527, remove yum reference since Python 3.10 is already provided in the dtcenter/met-base image * Per #527, upgrade tomcat to 9.0.89 and java to 17.0.11 * Per #527, add build_metviewer_docker.sh script and update Dockerfile.copy to call it. * Per #529, update call to build script * Per #529, migrate changes to Dockerfile * Per #572, remove geos-3.7.2 unsupported --enable-php configuration option. * Per #527, switch to using dtcenter/met-base-metviewer:v3.2 * Per #527, move configuring build.properties back into the Dockerfiles since it differs for Dockerfile.apptainer. Also modify Dockerfile.apptainer to use the dtcenter/met-base-metviewer image. * Per #526, fix syntax error in build_metviewer_docker.sh * Per #527, get docker build working for apptainer --- internal/scripts/docker/Dockerfile | 247 ++--------------- internal/scripts/docker/Dockerfile.apptainer | 257 ++---------------- internal/scripts/docker/Dockerfile.copy | 254 ++--------------- .../scripts/docker/build_metviewer_docker.sh | 98 +++++++ internal/scripts/docker/fix-permissions.sh | 8 +- 5 files changed, 184 insertions(+), 680 deletions(-) create mode 100755 internal/scripts/docker/build_metviewer_docker.sh diff --git a/internal/scripts/docker/Dockerfile b/internal/scripts/docker/Dockerfile index 0b57e51b..9c87a9aa 100644 --- a/internal/scripts/docker/Dockerfile +++ b/internal/scripts/docker/Dockerfile @@ -1,10 +1,13 @@ -FROM centos:7 +ARG MET_BASE_REPO=met-base-metviewer +ARG MET_BASE_TAG=v3.2 -MAINTAINER Tatiana Burek +FROM dtcenter/${MET_BASE_REPO}:${MET_BASE_TAG} +MAINTAINER John Halley Gotway # -# 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". +# 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". # ARG METVIEWER_GIT_NAME @@ -20,101 +23,35 @@ RUN if [ "x${METVIEWER_GIT_NAME}" = "x" ]; then \ exit 1; \ fi +ENV METVIEWER_GIT_URL https://github.com/dtcenter/METviewer +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 -# -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_MINOR_VERSION 5.61 -ENV TOMCAT_MAJOR_VERSION 8 -ENV TOMCAT_VERSION ${TOMCAT_MAJOR_VERSION}.${TOMCAT_MINOR_VERSION} - -# -# Install system updates -# -RUN yum -y update \ - && yum -y install epel-release \ - && yum -y install 'dnf-command(config-manager)' \ - && yum-config-manager --enable PowerTools - -# -# Install required packages -# -RUN yum -y install wget tar git ant java R mysql ksh \ - && rm -rf /var/cache/yum/* \ - && yum clean all - -# -# Install gsl-2.5 on which the R gsl package depends. -# The centos7 gal package is too old (version 1.5). -# -RUN echo "Compiling gsl-2.5" \ - && curl -SL http://gnu.askapache.com/gsl/gsl-2.5.tar.gz | tar zxC /lib \ - && cd /lib/gsl-2.5 \ - && ./configure --prefix=/usr --libdir=/usr/lib64 >& configure.log \ - && make >& make.log \ - && make install >& make_install.log - -# -# 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 +# Set env vars # -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')" +ENV PYTHONPATH "${PYTHONPATH}:/METviewer-python/METcalcpy/:/METviewer-python/METplotpy/" +ENV METPLOTPY_BASE "/METviewer-python/METplotpy/" # -# Install Tomcat +# Update the OS, as needed # -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 +RUN apt update && apt -y upgrade # -# Install METplus python components +# Clone the METviewer repository # -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} +RUN echo "Checking out METviewer ${METVIEWER_GIT_NAME} from ${METVIEWER_GIT_URL}" +RUN git clone --branch ${METVIEWER_GIT_NAME} ${METVIEWER_GIT_URL} /METviewer # -# Install METviewer +# Configure METviewer # -RUN echo "Checking out METviewer ${METVIEWER_GIT_NAME} from ${METVIEWER_GIT_URL}" -RUN git clone --branch ${METVIEWER_GIT_NAME} ${METVIEWER_GIT_URL} /METviewer \ - && echo "Configuring and building METviewer" \ +RUN echo "Configuring METviewer" \ && cd /METviewer \ && cat webapp/metviewer/WEB-INF/classes/build.properties | \ sed -r 's%db.host=.*%db.host=mysql_mv%g' | \ @@ -127,147 +64,13 @@ RUN git clone --branch ${METVIEWER_GIT_NAME} ${METVIEWER_GIT_URL} /METviewer \ 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 - -# -# Install Python 3.10.4 -# -RUN yum install gcc openssl11 openssl11-devel libreadline-gplv2-dev libncursesw5-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev openssl-devel libssl-dev bzip2-devel libffi-devel zlib-devel libproj-dev proj-data proj-bin libgeos-dev bzip2 -y -RUN mkdir /usr/local/openssl11 -WORKDIR /usr/local/openssl11 -RUN ln -s /usr/lib64/openssl11 lib -RUN ln -s /usr/include/openssl11 include - -RUN curl https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tgz --output /tmp/Python-3.10.4.tgz -WORKDIR /tmp -RUN tar xzf Python-3.10.4.tgz -WORKDIR /tmp/Python-3.10.4 -RUN ./configure --enable-optimizations --with-openssl=/usr/local/openssl11 -RUN yum install make -y -RUN make altinstall -RUN yum install which -y -WORKDIR /tmp -RUN rm -r Python-3.10.4.tgz -RUN yum -y install epel-release -RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py | python3.10 -RUN python3.10 -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip - -# -# 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 --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/" + > build.properties # -# Remove unneeded scripts +# Run the build script # -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 +RUN cd /METviewer \ + && internal/scripts/docker/build_metviewer_docker.sh -# -# 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"] - diff --git a/internal/scripts/docker/Dockerfile.apptainer b/internal/scripts/docker/Dockerfile.apptainer index 4f18ba12..f0da9f62 100644 --- a/internal/scripts/docker/Dockerfile.apptainer +++ b/internal/scripts/docker/Dockerfile.apptainer @@ -1,10 +1,13 @@ -FROM centos:7 +ARG MET_BASE_REPO=met-base-metviewer +ARG MET_BASE_TAG=v3.2 -MAINTAINER Tatiana Burek +FROM dtcenter/${MET_BASE_REPO}:${MET_BASE_TAG} +MAINTAINER John Halley Gotway # -# 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". +# 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". # ARG METVIEWER_GIT_NAME @@ -18,7 +21,10 @@ ARG METDATAIO_GIT_NAME=develop 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; \ - fi + fi + +ENV METVIEWER_GIT_URL https://github.com/dtcenter/METviewer +ENV CATALINA_HOME /opt/tomcat RUN echo "Build Argument METVIEWER_GIT_NAME=${METVIEWER_GIT_NAME}" \ && echo "Build Argument METPLOTPY_GIT_NAME=${METPLOTPY_GIT_NAME}" \ @@ -26,106 +32,36 @@ RUN echo "Build Argument METVIEWER_GIT_NAME=${METVIEWER_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 -# -ENV TOMCAT_MINOR_VERSION 5.61 -ENV TOMCAT_MAJOR_VERSION 8 -ENV TOMCAT_VERSION ${TOMCAT_MAJOR_VERSION}.${TOMCAT_MINOR_VERSION} - -# -# Install system updates -# -RUN yum -y update \ - && yum -y install epel-release \ - && yum -y install 'dnf-command(config-manager)' \ - && yum-config-manager --enable PowerTools - -# -# Install MariaDB server +# Set env vars # -RUN yum -y install --setopt=tsflags=nodocs epel-release && \ - yum -y install --setopt=tsflags=nodocs mariadb-server bind-utils pwgen psmisc hostname && \ - yum -y erase vim-minimal && \ - yum -y update && yum clean all +ENV PYTHONPATH "${PYTHONPATH}:/METviewer-python/METcalcpy/:/METviewer-python/METplotpy/" +ENV METPLOTPY_BASE "/METviewer-python/METplotpy/" # -# Install required packages +# Run as root # USER root -RUN yum -y install wget tar git ant R mysql ksh \ - && rm -rf /var/cache/yum/* \ - && yum clean all - -RUN yum install java-1.8.0-openjdk-devel - -# -# Install gsl-2.5 on which the R gsl package depends. -# The centos7 gal package is too old (version 1.5). -# -RUN echo "Compiling gsl-2.5" \ - && curl -SL http://gnu.askapache.com/gsl/gsl-2.5.tar.gz | tar zxC /lib \ - && cd /lib/gsl-2.5 \ - && ./configure --prefix=/usr --libdir=/usr/lib64 >& configure.log \ - && make >& make.log \ - && make install >& make_install.log - -# -# 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 +# Update the OS, as needed # -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')" +RUN apt update && apt -y upgrade # -# Install Tomcat +# Install additional packages for MariaDB server # -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 +RUN apt -y install mariadb-server bind9-utils pwgen psmisc hostname # -# Install METplus python components +# Clone the METviewer repository # -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} +RUN echo "Checking out METviewer ${METVIEWER_GIT_NAME} from ${METVIEWER_GIT_URL}" +RUN git clone --branch ${METVIEWER_GIT_NAME} ${METVIEWER_GIT_URL} /METviewer # -# Install METviewer +# Configure METviewer # -RUN echo "Checking out METviewer ${METVIEWER_GIT_NAME} from ${METVIEWER_GIT_URL}" -RUN git clone --branch ${METVIEWER_GIT_NAME} ${METVIEWER_GIT_URL} /METviewer \ - && echo "Configuring and building METviewer" \ +RUN echo "Configuring METviewer" \ && cd /METviewer \ && cat webapp/metviewer/WEB-INF/classes/build.properties | \ sed -r 's%db.host=.*%db.host=localhost%g' | \ @@ -138,150 +74,13 @@ RUN git clone --branch ${METVIEWER_GIT_NAME} ${METVIEWER_GIT_URL} /METviewer \ 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 - -# -# Install Python 3.10.4 -# -RUN yum install gcc openssl11 openssl11-devel libreadline-gplv2-dev libncursesw5-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev openssl-devel libssl-dev bzip2-devel libffi-devel zlib-devel libproj-dev proj-data proj-bin libgeos-dev bzip2 -y -RUN mkdir /usr/local/openssl11 -WORKDIR /usr/local/openssl11 -RUN ln -s /usr/lib64/openssl11 lib -RUN ln -s /usr/include/openssl11 include - -RUN curl https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tgz --output /tmp/Python-3.10.4.tgz -WORKDIR /tmp -RUN tar xzf Python-3.10.4.tgz -WORKDIR /tmp/Python-3.10.4 -RUN ./configure --enable-optimizations --with-openssl=/usr/local/openssl11 -RUN yum install make -y -RUN make altinstall -RUN yum install which -y -WORKDIR /tmp -RUN rm -r Python-3.10.4.tgz -RUN yum -y install epel-release -RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py | python3.10 -RUN python3.10 -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip - -# -# 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 --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 + > build.properties # -# Database install +# Run the build script # +RUN cd /METviewer \ + && internal/scripts/docker/build_metviewer_docker.sh # # Fix permissions to allow for running on openshift diff --git a/internal/scripts/docker/Dockerfile.copy b/internal/scripts/docker/Dockerfile.copy index 8b73beea..d17081b8 100644 --- a/internal/scripts/docker/Dockerfile.copy +++ b/internal/scripts/docker/Dockerfile.copy @@ -1,19 +1,22 @@ -FROM centos:7 +ARG MET_BASE_REPO=met-base-metviewer +ARG MET_BASE_TAG=v3.2 -MAINTAINER Tatiana Burek +FROM dtcenter/${MET_BASE_REPO}:${MET_BASE_TAG} +MAINTAINER John Halley Gotway # -# 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". +# 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 +ENV METPLOTPY_GIT_NAME=develop +ENV METCALCPY_GIT_NAME=develop +ENV METDATAIO_GIT_NAME=develop # -# SOURCE_BRANCH is required to define the branch of the local METviewer repository. +# SOURCE_BRANCH is required to define the local METviewer repository branch name. # RUN if [ "x${SOURCE_BRANCH}" = "x" ]; then \ echo "ERROR: SOURCE_BRANCH undefined! Rebuild with \"--build-arg SOURCE_BRANCH={branch name}\""; \ @@ -21,7 +24,10 @@ RUN if [ "x${SOURCE_BRANCH}" = "x" ]; then \ else \ 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}" \ @@ -29,88 +35,15 @@ RUN echo "Build Argument METVIEWER_GIT_NAME=${METVIEWER_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 -# -ENV TOMCAT_MINOR_VERSION 5.61 -ENV TOMCAT_MAJOR_VERSION 8 -ENV TOMCAT_VERSION ${TOMCAT_MAJOR_VERSION}.${TOMCAT_MINOR_VERSION} - -# -# Install system updates -# -RUN yum -y update \ - && yum -y install epel-release \ - && yum -y install 'dnf-command(config-manager)' \ - && yum-config-manager --enable PowerTools - -# -# Install required packages -# -RUN yum -y install wget tar git ant java R mysql ksh \ - && rm -rf /var/cache/yum/* \ - && yum clean all - -# -# Install gsl-2.5 on which the R gsl package depends. -# The centos7 gal package is too old (version 1.5). -# -RUN echo "Compiling gsl-2.5" \ - && curl -SL http://gnu.askapache.com/gsl/gsl-2.5.tar.gz | tar zxC /lib \ - && cd /lib/gsl-2.5 \ - && ./configure --prefix=/usr --libdir=/usr/lib64 >& configure.log \ - && make >& make.log \ - && make install >& make_install.log - -# -# 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 +# Set env vars # -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 +ENV PYTHONPATH "${PYTHONPATH}:/METviewer-python/METcalcpy/:/METviewer-python/METplotpy/" +ENV METPLOTPY_BASE "/METviewer-python/METplotpy/" # -# Install METplus python components +# Update the OS, as needed # -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} +RUN apt update && apt -y upgrade # # Copy in the local METviewer repository @@ -125,7 +58,10 @@ RUN if [ ! -e "/METviewer/build.xml" ]; then \ exit 1; \ fi -RUN echo "Configuring and building METviewer" \ +# +# Configure METviewer +# +RUN echo "Configuring METviewer" \ && cd /METviewer \ && cat webapp/metviewer/WEB-INF/classes/build.properties | \ sed -r 's%db.host=.*%db.host=mysql_mv%g' | \ @@ -138,147 +74,13 @@ RUN echo "Configuring and building METviewer" \ 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 + > build.properties # -# Install Python 3.10.4 +# Run the build script # -RUN yum install gcc openssl11 openssl11-devel libreadline-gplv2-dev libncursesw5-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev openssl-devel libssl-dev bzip2-devel libffi-devel zlib-devel libproj-dev proj-data proj-bin libgeos-dev bzip2 -y -RUN mkdir /usr/local/openssl11 -WORKDIR /usr/local/openssl11 -RUN ln -s /usr/lib64/openssl11 lib -RUN ln -s /usr/include/openssl11 include - -RUN curl https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tgz --output /tmp/Python-3.10.4.tgz -WORKDIR /tmp -RUN tar xzf Python-3.10.4.tgz -WORKDIR /tmp/Python-3.10.4 -RUN ./configure --enable-optimizations --with-openssl=/usr/local/openssl11 -RUN yum install make -y -RUN make altinstall -RUN yum install which -y -WORKDIR /tmp -RUN rm -r Python-3.10.4.tgz -RUN yum -y install epel-release -RUN curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py | python3.10 -RUN python3.10 -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip +RUN cd /METviewer \ + && internal/scripts/docker/build_metviewer_docker.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 --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"] - diff --git a/internal/scripts/docker/build_metviewer_docker.sh b/internal/scripts/docker/build_metviewer_docker.sh new file mode 100755 index 00000000..2eef371d --- /dev/null +++ b/internal/scripts/docker/build_metviewer_docker.sh @@ -0,0 +1,98 @@ +#! /bin/bash + +echo "Running script to build METviewer and its dependencies in Docker" + +# GitHub constants +export METPLOTPY_GIT_URL=https://github.com/dtcenter/METplotpy +export METCALCPY_GIT_URL=https://github.com/dtcenter/METcalcpy +export METDATAIO_GIT_URL=https://github.com/dtcenter/METdataio + +# Check for required environment variables +if [ -z ${CATALINA_HOME+x} ]; then + echo "ERROR: \${CATALINA_HOME} is required!" + exit 1 +fi +if [ -z ${METPLOTPY_GIT_NAME+x} ]; then + echo "ERROR: \${METPLOTPY_GIT_NAME} is required!" + exit 1 +fi +if [ -z ${METCALCPY_GIT_NAME+x} ]; then + echo "ERROR: \${METCALCPY_GIT_NAME} is required!" + exit 1 +fi +if [ -z ${METDATAIO_GIT_NAME+x} ]; then + echo "ERROR: \${METDATAIO_GIT_NAME} is required!" + exit 1 +fi + +# Update the OS, as needed +apt update && apt -y upgrade + +# Install METplus python components +mkdir /METviewer-python +cd /METviewer-python + +echo "Checking out METcalcpy ${METCALCPY_GIT_NAME} from ${METCALCPY_GIT_URL}" +git clone --branch ${METCALCPY_GIT_NAME} ${METCALCPY_GIT_URL} + +echo "Checking out METplotpy ${METPLOTPY_GIT_NAME} from ${METPLOTPY_GIT_URL}" +git clone --branch ${METPLOTPY_GIT_NAME} ${METPLOTPY_GIT_URL} + +echo "Checking out METdataio ${METDATAIO_GIT_NAME} from ${METDATAIO_GIT_URL}" +git clone --branch ${METDATAIO_GIT_NAME} ${METDATAIO_GIT_URL} + +# Build METviewer + +echo "Building METviewer" +cd /METviewer + +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 + +# Remove unneeded scripts +rm /METviewer/bin/auto_test.sh \ + /METviewer/bin/mv_test.sh \ + /METviewer/bin/nightly_test.sh \ + /METviewer/bin/prep_dist.sh \ + /METviewer/bin/mv_compare.sh +rm -r /METviewer/test + +# Change permissions of the scripts +chmod 755 /METviewer/bin/*.sh diff --git a/internal/scripts/docker/fix-permissions.sh b/internal/scripts/docker/fix-permissions.sh index e25ee3a5..10cbbc71 100755 --- a/internal/scripts/docker/fix-permissions.sh +++ b/internal/scripts/docker/fix-permissions.sh @@ -2,6 +2,8 @@ # Taken from https://raw.githubusercontent.com/openshift/sti-base/master/bin/fix-permissions # Fix permissions on the given directory to allow group read/write of # regular files and execute of directories. -chgrp -R 0 $1 -chmod -R g+rw $1 -find $1 -type d -exec chmod g+x {} + +if [ -d $1 ]; then + chgrp -R 0 $1 + chmod -R g+rw $1 + find $1 -type d -exec chmod g+x {} + +fi