Changeset 14073


Ignore:
Timestamp:
Nov 15, 2019 10:20:54 AM (4 weeks ago)
Author:
aramle
Message:

#5877 Creating first draft for building images with Python 3.

Location:
BaseDockerImages/branches/dev-2379
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • BaseDockerImages/branches/dev-2379/Dockerfile

    r13415 r14073  
    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
     
    4346RUN ${DOCKER_SRC_DIR}/setup_openjdk.sh
    4447RUN ${DOCKER_SRC_DIR}/setup_requirements.sh
     48RUN ${DOCKER_SRC_DIR}/setup_python.sh
    4549RUN ${DOCKER_SRC_DIR}/setup_gcc.sh
    4650RUN ${DOCKER_SRC_DIR}/setup_ant.sh
  • BaseDockerImages/branches/dev-2379/Jenkinsfile

    r13415 r14073  
    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="2") {
     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"
     50   
     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    }
    4573   
    4674    imageName = "ubuntu_base"
     
    6795    }
    6896   
    69     imageName = "centos_base"
    70     platformVersion = "7.4.1708"
    71     pushTag = "7.4"
     97
    7298   
    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     }
    9499}
  • BaseDockerImages/branches/dev-2379/scripts/setup_requirements.sh

    r13415 r14073  
    2222BUILD_PKGS_JM_COMMON="vim sudo cmake swig wget tar patch"
    2323# 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"
     24BUILD_PKGS_JM_REDHAT="redhat-lsb dos2unix bc make lucene which subversion zlib-devel boost-devel"
     25BUILD_PKGS_JM_DEBIAN="dos2unix dc ant subversion zlib1g-dev libboost-dev"
    2726
    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"
     27
    2928
    3029if [ "$LINUX_DISTRIBUTION" = "CENTOS" ]; then
    3130    BUILD_PKGS_JM=$BUILD_PKGS_JM_REDHAT
    3231    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
    3832    alias pckinstall="yum -y install"
    3933elif [ "$LINUX_DISTRIBUTION" = "REDHAT" ]; then
     
    5448pckinstall $BUILD_PKGS_JM
    5549
    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
    7350
    74 
    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.