Changeset 14155


Ignore:
Timestamp:
Nov 25, 2019 8:39:37 AM (3 weeks ago)
Author:
aramle
Message:

Merged revision(s) 14069-14154 from BaseDockerImages/branches/dev-2379:

Location:
BaseDockerImages/trunk
Files:
9 edited
2 copied

Legend:

Unmodified
Added
Removed
  • BaseDockerImages/trunk

  • BaseDockerImages/trunk/Dockerfile

    r13415 r14155  
    3131ENV GCC_VERSION=${GCC_VERSION_TO_BUILD}
    3232
     33ARG PYTHON_VERSION=3
     34ENV PYTHON_VERSION=${PYTHON_VERSION}
     35
    3336RUN useradd -ms /bin/bash baseuser && groupadd docker && usermod -aG docker baseuser
    3437# switch user back and forth to create bashrc
     
    3841COPY ${SRC_DIR}/*.sh ${DOCKER_SRC_DIR}/
    3942COPY ${SRC_DIR}/jcc.patch ${DOCKER_SRC_DIR}/
     43COPY ${SRC_DIR}/jcc35.patch ${DOCKER_SRC_DIR}/
    4044RUN chmod +x ${DOCKER_SRC_DIR}/*.sh
    4145
     
    4448RUN ${DOCKER_SRC_DIR}/setup_requirements.sh
    4549RUN ${DOCKER_SRC_DIR}/setup_gcc.sh
     50RUN ${DOCKER_SRC_DIR}/setup_python.sh
    4651RUN ${DOCKER_SRC_DIR}/setup_ant.sh
    47 RUN ${DOCKER_SRC_DIR}/setup_ipopt.sh
    4852RUN ${DOCKER_SRC_DIR}/setup_jcc.sh
    4953RUN ${DOCKER_SRC_DIR}/centos_python_env.sh
     54RUN ${DOCKER_SRC_DIR}/setup_ipopt.sh
    5055RUN rm -rf ${USR_PATH}
    5156RUN rm -rf /*.tgz
  • BaseDockerImages/trunk/Jenkinsfile

    r13415 r14155  
    2020def pushTag
    2121
    22 def buildBaseImage(image_name, repo_name, platform, platform_version, gcc_install_type) {
    23     return docker.build("${repo_name}/$image_name", "--no-cache --pull --build-arg DOCKER_LINUX_DIST=$platform --build-arg DOCKER_DIST_TAG=$platform_version --build-arg GCC_INSTALL_TYPE=$gcc_install_type --build-arg ENABLE_PYTHON="yes" .")
     22def buildBaseImage(image_name, repo_name, platform, platform_version, gcc_install_type, python_version="3") {
     23    return docker.build("${repo_name}/$image_name", "--no-cache --pull --build-arg DOCKER_LINUX_DIST=$platform --build-arg DOCKER_DIST_TAG=$platform_version --build-arg GCC_INSTALL_TYPE=$gcc_install_type --build-arg ENABLE_PYTHON=\"yes\" --build-arg PYTHON_VERSION=$python_version .")
    2424}
    2525
     
    4343
    4444node('docker') {
     45
     46    imageName = "centos_py3_base"
     47    platformVersion = "7.4.1708"
     48    pushTag = "7.4"
     49    python_version="3"
    4550   
    46     imageName = "ubuntu_base"
     51    stage ("Building ${imageName} ${platformVersion} Python ${python_version}") {
     52        checkout scm
     53        def dockerImageRef = buildBaseImage("${imageName}", "${repoName}", "centos", "${platformVersion}", "CENTOS_DEFAULT", "${python_version}")
     54        dockerImageRef.inside {
     55            sh 'echo Built version: && cat /etc/centos-release'
     56        }
     57        //pushImage(dockerImageRef, "${repoName}", "${imageName}", "${pushTag}")
     58    }
     59   
     60    imageName = "centos_py2_base"
     61    platformVersion = "7.4.1708"
     62    pushTag = "7.4"
     63    python_version="2"
     64   
     65    stage ("Building ${imageName} ${platformVersion} Python ${python_version}") {
     66        checkout scm
     67        def dockerImageRef = buildBaseImage("${imageName}", "${repoName}", "centos", "${platformVersion}", "CENTOS_DEFAULT", "${python_version}")
     68        dockerImageRef.inside {
     69            sh 'echo Built version: && cat /etc/centos-release'
     70        }
     71        //pushImage(dockerImageRef, "${repoName}", "${imageName}", "${pushTag}")
     72    }
     73   
     74    imageName = "ubuntu_py3_base"
    4775    platformVersion = "18.04"
    4876    pushTag = "18.04"
     77    python_version="3"
    4978   
    50     stage ("Building ${imageName} ${platformVersion}") {
    51         //checkout scm
    52         //def dockerImageRef = buildBaseImage("${imageName}", "${repoName}", "ubuntu", "${platformVersion}", "UBUNTU_DEFAULT")
    53         //pushImage(dockerImageRef, "${repoName}", "${imageName}", "${pushTag}")
     79    stage ("Building ${imageName} ${platformVersion} Python ${python_version}") {
     80        checkout scm
     81        def dockerImageRef = buildBaseImage("${imageName}", "${repoName}", "ubuntu", "${platformVersion}", "UBUNTU_DEFAULT", "${python_version}")
     82        pushImage(dockerImageRef, "${repoName}", "${imageName}", "${pushTag}")K
    5483    }
    5584   
     
    6796    }
    6897   
    69     imageName = "centos_base"
    70     platformVersion = "7.4.1708"
    71     pushTag = "7.4"
     98
    7299   
    73     stage ("Building ${imageName} ${platformVersion}") {
    74         checkout scm
    75         def dockerImageRef = buildBaseImage("${imageName}", "${repoName}", "centos", "${platformVersion}", "CENTOS_DEFAULT")
    76         dockerImageRef.inside {
    77             sh 'echo Built version: && cat /etc/centos-release'
    78         }
    79         //pushImage(dockerImageRef, "${repoName}", "${imageName}", "${pushTag}")
    80     }
    81    
    82     imageName = "centos_base"
    83     platformVersion = "7.2.1511"
    84     pushTag = "7.2"
    85    
    86     stage ("Building ${imageName} ${platformVersion}") {
    87         //checkout scm
    88         //def dockerImageRef = buildBaseImage("${imageName}", "${repoName}", "centos", "${platformVersion}", "CENTOS_DEFAULT")
    89         //dockerImageRef.inside {
    90         //    sh 'echo Built version: && cat /etc/centos-release'
    91         //}
    92         //pushImage(dockerImageRef, "${repoName}", "${imageName}", "${pushTag}")
    93     }
    94100}
  • BaseDockerImages/trunk/scripts/centos_python_env.sh

    r13405 r14155  
    2323    echo "Not setting matplotlib backend for CentOS 6"
    2424else
    25     sed -i "/^backend/c\\backend:Agg" $(python -c "import matplotlib;print(matplotlib.matplotlib_fname())")
     25    if [ "$PYTHON_VERSION" = "3" ]; then
     26        sed -i "/^backend/c\\backend:Agg" $(python3 -c "import matplotlib;print(matplotlib.matplotlib_fname())")
     27    else
     28        sed -i "/^backend/c\\backend:Agg" $(python -c "import matplotlib;print(matplotlib.matplotlib_fname())")
     29    fi
    2630fi
    2731
  • BaseDockerImages/trunk/scripts/setup_ant.sh

    r13415 r14155  
     1#!/bin/bash
    12#
    23#    Copyright (C) 2019 Modelon AB
     
    2425    wget http://archive.apache.org/dist/ant/binaries/apache-ant-$ANT_VERSION-bin.tar.gz
    2526    ANTTMP=anttmp
    26     mkdir $ANTTMP && cd $ANTTMP && tar -xvf ../apache-ant-$ANT_VERSION-bin.tar.gz && cd ..
    27     mv $ANTTMP/apache-ant-$ANT_VERSION /opt/ant && rm -rf apache-ant-$ANT_VERSION-bin.tar.gz && rm -rf $ANTTMP
     27    mkdir /opt/ant && mkdir $ANTTMP && cd $ANTTMP && tar -xvf ../apache-ant-$ANT_VERSION-bin.tar.gz && cd ..
     28    mv $ANTTMP/apache-ant-$ANT_VERSION/* /opt/ant && rm -rf apache-ant-$ANT_VERSION-bin.tar.gz && rm -rf $ANTTMP
     29    ls -ls opt/ant
    2830    echo 'export ANT_HOME=/opt/ant/'>/etc/profile.d/antenv.sh
    2931    chmod 0755 /etc/profile.d/antenv.sh
     32    ln -s /opt/ant/bin/ant /usr/bin/ant
    3033fi
  • BaseDockerImages/trunk/scripts/setup_gcc.sh

    r13415 r14155  
     1#!/bin/bash
    12#
    23#    Copyright (C) 2018 Modelon AB
  • BaseDockerImages/trunk/scripts/setup_jcc.sh

    r13415 r14155  
    2020    if [ -f /etc/centos-release ] || [ -f /etc/fedora-release ];
    2121    then
    22         export JCC_JDK=$(readlink -f /usr/bin/java | cut -d '/' -f-5)
     22        export JCC_JDK=$(readlink -f /usr/bin/java | cut -d '/' -f-5)       
    2323    else
    24         export JCC_JDK=$(find /usr -type f -name "jni.h" | cut -d '/' -f-5 | grep "java-8")
     24        export JCC_JDK=$(find /usr -type f -name "jni.h" | cut -d '/' -f-5 | grep "java-11")
    2525    fi
    26 
     26    export JCC_LFLAGS=$(find /usr -type f -name "libjvm.so")
    2727    echo "GOT JCC_JDK="$JCC_JDK
    2828    lines=$(echo $JCC_JDK | wc -l)
     
    3333        exit 1
    3434    fi
    35 
    36     pip install jcc==2.23
     35    if [ "$PYTHON_VERSION" = "3" ]; then
     36        pip3 install jcc==3.5
     37        patch_name=jcc35.patch
     38    else
     39        pip install jcc==2.23
     40        patch_name=jcc.patch
     41    fi
    3742
    3843    JCC_INSTALL_DIR=$(find /usr -type d -name jcc | sed -n 1p)
    39     cp ${DOCKER_SRC_DIR}/jcc.patch ${JCC_INSTALL_DIR}
     44    cp ${DOCKER_SRC_DIR}/${patch_name} ${JCC_INSTALL_DIR}
    4045    cd ${JCC_INSTALL_DIR}
    41     patch < jcc.patch
     46    patch < ${patch_name}
    4247
    43     rm -i jcc.patch
     48    rm -rf ${patch_name}
    4449fi
  • BaseDockerImages/trunk/scripts/setup_openjdk.sh

    r13415 r14155  
     1#!/bin/bash
    12#
    23#    Copyright (C) 2019 Modelon AB
     
    3334    yum -y install java-1.8.0-openjdk-devel
    3435elif [ "$LINUX_DISTRIBUTION" = "DEBIAN" ]; then
    35     apt-get -y install openjdk-8-jdk
     36    apt-get update
     37    apt-get install -y software-properties-common
     38    add-apt-repository ppa:openjdk-r/ppa
     39    apt-get update -q
     40    apt-get install -y openjdk-11-jdk
    3641else
    3742    echo "${ME}: No set openjdk distribution for current linux distribution, exiting..."
  • BaseDockerImages/trunk/scripts/setup_requirements.sh

    r13415 r14155  
    1616set -e
    1717
    18 ME="$( basename "${BASH_SOURCE[0]}" )"
    19 
    2018. ${DOCKER_SRC_DIR}/settings.sh
    2119
    2220BUILD_PKGS_JM_COMMON="vim sudo cmake swig wget tar patch"
    2321# removed ant-junit from REDHAT list
    24 BUILD_PKGS_JM_REDHAT="redhat-lsb dos2unix python-pip bc make lucene which subversion python-devel python-jpype zlib-devel boost-devel"
    25 BUILD_PKGS_JM_FEDORA="redhat-lsb ant-junit dos2unix bc make lucene which subversion zlib-devel python-pip python-devel python-jpype boost-devel"
    26 BUILD_PKGS_JM_DEBIAN="dos2unix dc ant python-lucene subversion python-dev python-jpype zlib1g-dev libboost-dev"
     22BUILD_PKGS_JM_REDHAT="redhat-lsb dos2unix bc make lucene which subversion zlib-devel boost-devel"
     23BUILD_PKGS_JM_DEBIAN="dos2unix dc ant subversion zlib1g-dev libboost-dev"
    2724
    28 BUILD_PYTHON_PIP_PACKAGES="html5lib notebook==5.7.8 jupyter colorama nbformat Jinja2 openpyxl mock natsort six MarkupSafe lxml>=4.0.0 matplotlib==2.0.2 scipy==1.2.2 cython==0.29.13 nose ipython==5.7 ipykernel==4.10.0"
     25
    2926
    3027if [ "$LINUX_DISTRIBUTION" = "CENTOS" ]; then
    3128    BUILD_PKGS_JM=$BUILD_PKGS_JM_REDHAT
    3229    yum -y install epel-release  # for some python packages
    33     alias pckinstall="yum -y install"
    34 elif [ "$LINUX_DISTRIBUTION" = "FEDORA" ]; then
    35     BUILD_PKGS_JM=$BUILD_PKGS_JM_FEDORA
    36     dnf update --best --allowerasing -y
    37     dnf install redhat-rpm-config -y
    38     alias pckinstall="yum -y install"
     30    pckinstall="yum -y install"
    3931elif [ "$LINUX_DISTRIBUTION" = "REDHAT" ]; then
    4032    BUILD_PKGS_JM=$BUILD_PKGS_JM_REDHAT
    4133    yum -y install epel-release  # for some python packages
    42     alias pckinstall="yum -y install"
     34    pckinstall="yum -y install"
    4335elif [ "$LINUX_DISTRIBUTION" = "DEBIAN" ]; then
    4436    BUILD_PKGS_JM=$BUILD_PKGS_JM_DEBIAN
    4537    apt-get update
    4638    apt-get -y install tzdata #install separately due to issues with backends in docker
    47     alias pckinstall="apt-get -y install"
     39    pckinstall="apt-get -y install"
    4840else
    4941    echo ERROR: current linux distribution not supported yet
     
    5143fi
    5244
    53 pckinstall $BUILD_PKGS_JM_COMMON
    54 pckinstall $BUILD_PKGS_JM
    55 
    56 if [ "$LINUX_DISTRIBUTION" = "DEBIAN" ]; then
    57     # to avoid installing gcc 7 as well for ubuntu we do this
    58     apt-get install -y --no-install-recommends python-pip
    59    
    60     if [ ! -z "${PYTHON_ENABLED}" ]; then
    61         pip install setuptools
    62     fi
    63    
    64     echo "${ME}: Installing extra packages for Ubuntu"
    65     #Install package lsb separately because it conflicts with the installation above
    66     apt-get -y install lsb python3-notebook jupyter-core python-ipykernel
    67    
    68     echo "Installing extra python packages with pip on Ubuntu"
    69     if [ ! -z "${PYTHON_ENABLED}" ]; then
    70         pip install numpy==1.14.4
    71     fi
    72 fi
     45${pckinstall} $BUILD_PKGS_JM_COMMON
     46${pckinstall} $BUILD_PKGS_JM
    7347
    7448
    75 if [ -f /etc/centos-release ] && [ "$(cat /etc/centos-release | tr -dc '0-9.'|cut -d \. -f1)" -eq "6" ];
    76 then
    77     echo "${ME}: Not installing python packages on CentOS 6"
    78 else
    79     if [ ! -z "${PYTHON_ENABLED}" ]; then
    80         echo "${ME}:  Installing python packages..."
    81         pip install $BUILD_PYTHON_PIP_PACKAGES
    82     fi
    83 fi
    84 
    85 if [ ! -z "${PYTHON_ENABLED}" ]; then
    86     echo "${ME}: Installed python packages:"
    87     pip list
    88 fi
    89 
Note: See TracChangeset for help on using the changeset viewer.