From f608b07532686c7bee6e441537f3fddd4809dfb5 Mon Sep 17 00:00:00 2001 From: jackyu Date: Wed, 11 Dec 2024 10:06:13 +0800 Subject: [PATCH 1/3] replace base image centos by ubuntu --- base/Dockerfile | 62 ++++++++++++++++-------------------- base/podman/Dockerfile | 72 ++++++++++++++++++------------------------ 2 files changed, 57 insertions(+), 77 deletions(-) diff --git a/base/Dockerfile b/base/Dockerfile index ecc5d48..342933c 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -1,57 +1,49 @@ -FROM centos:7 +FROM ubuntu:22.04 # utils -RUN yum install -y epel-release ca-certificates && \ - yum install -y unzip \ - which \ - make \ - wget \ - zip \ - bzip2 \ - gcc \ - gcc-c++ \ - curl-devel \ - autoconf \ - expat-devel \ - gettext-devel \ - openssl-devel \ - perl-devel \ - zlib-devel \ - python-pip \ - java-1.8.0-openjdk && \ - yum -y clean all --enablerepo='*' - -RUN wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz && \ - tar zxvf git-2.9.5.tar.gz --no-same-owner && \ - cd git-2.9.5 && \ +RUN apt-get update && \ + apt-get install -y ca-certificates \ + gcc build-essential make autoconf cmake \ + zip bzip2 unzip \ + curl wget vim \ + libexpat1 libexpat1-dev gettext jq \ + libcurl4-openssl-dev openssl \ + perl \ + zlib1g-dev \ + openjdk-17-jdk && \ + apt-get clean autoclean + +ENV GIT_VERSION 2.46.0 +RUN wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz && \ + tar zxvf git-${GIT_VERSION}.tar.gz --no-same-owner && \ + cd git-${GIT_VERSION} && \ make configure && \ ./configure prefix=/usr/local/git/ && \ make && \ make install && \ - mv /usr/local/git/bin/git /usr/bin/ && \ + ln -s /usr/local/git/bin/git /usr/bin/git && \ cd ..&& \ - rm -rf git-2.9.5.tar.gz git-2.9.5 && \ + rm -rf git-${GIT_VERSION}.tar.gz git-${GIT_VERSION} && \ git version - - # Set the locale(en_US.UTF-8) ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 +ENV PATH $PATH:/usr/local/bin # USER jenkins WORKDIR /home/jenkins -ENV SONAR_SCANNER_VERSION 3.3.0.1492 - +# install sonarqube +ENV SONAR_SCANNER_VERSION 4.6.0.2311 RUN curl -o sonar_scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip && \ - unzip sonar_scanner.zip && rm sonar_scanner.zip \ - && rm -rf sonar-scanner-$SONAR_SCANNER_VERSION-linux/jre && \ + unzip sonar_scanner.zip && rm sonar_scanner.zip && \ + rm -rf sonar-scanner-$SONAR_SCANNER_VERSION-linux/jre && \ sed -i 's/use_embedded_jre=true/use_embedded_jre=false/g' /home/jenkins/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin/sonar-scanner && \ - mv /home/jenkins/sonar-scanner-$SONAR_SCANNER_VERSION-linux /usr/bin - -ENV PATH $PATH:/usr/bin/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin + mv /home/jenkins/sonar-scanner-$SONAR_SCANNER_VERSION-linux /usr/local/lib && \ + ln -s /usr/local/lib/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin/sonar-scanner /usr/local/bin/sonar-scanner && \ + ln -s /usr/local/lib/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin/sonar-scanner-debug /usr/local/bin/sonar-scanner-debug COPY ./ ./ RUN ./hack/install_utils.sh && rm -rf ./* diff --git a/base/podman/Dockerfile b/base/podman/Dockerfile index 8934da6..a8c220e 100644 --- a/base/podman/Dockerfile +++ b/base/podman/Dockerfile @@ -1,69 +1,57 @@ -FROM centos:7 +FROM ubuntu:22.04 # utils -RUN yum install -y epel-release ca-certificates && \ - yum install -y unzip \ - which \ - make \ - wget \ - zip \ - bzip2 \ - gcc \ - gcc-c++ \ - curl-devel \ - autoconf \ - expat-devel \ - gettext-devel \ - openssl-devel \ - perl-devel \ - zlib-devel \ - python-pip \ - java-1.8.0-openjdk && \ - yum -y clean all --enablerepo='*' - -RUN wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz && \ - tar zxvf git-2.9.5.tar.gz --no-same-owner && \ - cd git-2.9.5 && \ +RUN apt-get update && \ + apt-get install -y ca-certificates \ + gcc build-essential make autoconf cmake \ + zip bzip2 unzip \ + curl wget vim \ + libexpat1 libexpat1-dev gettext jq \ + openssl \ + perl \ + zlib1g-dev \ + openjdk-17-jdk && \ + apt-get clean autoclean + +ENV GIT_VERSION 2.46.0 +RUN wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz && \ + tar zxvf git-${GIT_VERSION}.tar.gz --no-same-owner && \ + cd git-${GIT_VERSION} && \ make configure && \ ./configure prefix=/usr/local/git/ && \ make && \ make install && \ mv /usr/local/git/bin/git /usr/bin/ && \ - cd .. && \ - rm -rf git-2.9.5.tar.gz git-2.9.5 && \ + cd ..&& \ + rm -rf git-${GIT_VERSION}.tar.gz git-${GIT_VERSION} && \ git version # Set the locale(en_US.UTF-8) ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV LC_ALL en_US.UTF-8 +ENV PATH $PATH:/usr/local/bin # USER jenkins WORKDIR /home/jenkins +# install sonarqube ENV SONAR_SCANNER_VERSION 3.3.0.1492 - RUN curl -o sonar_scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip && \ - unzip sonar_scanner.zip && rm sonar_scanner.zip \ - && rm -rf sonar-scanner-$SONAR_SCANNER_VERSION-linux/jre && \ + unzip sonar_scanner.zip && rm sonar_scanner.zip && \ + rm -rf sonar-scanner-$SONAR_SCANNER_VERSION-linux/jre && \ sed -i 's/use_embedded_jre=true/use_embedded_jre=false/g' /home/jenkins/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin/sonar-scanner && \ - mv /home/jenkins/sonar-scanner-$SONAR_SCANNER_VERSION-linux /usr/bin - -ENV PATH $PATH:/usr/bin/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin - -COPY ./ ./ + mv /home/jenkins/sonar-scanner-$SONAR_SCANNER_VERSION-linux /usr/local/lib && \ + ln -s /usr/local/lib/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin/sonar-scanner /usr/local/bin/sonar-scanner && \ + ln -s /usr/local/lib/sonar-scanner-$SONAR_SCANNER_VERSION-linux/bin/sonar-scanner-debug /usr/local/bin/sonar-scanner-debug ENV EXCLUDE_DOCKER 1 -RUN ./hack/install_utils.sh && rm -rf ./* +COPY ./ ./ +RUN ./hack/install_utils.sh && mkdir -p /etc/containers && cp storage.conf containers.conf /etc/containers/ && rm -rf ./* # Install podman -RUN curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_7/devel:kubic:libcontainers:stable.repo && \ - yum -y install podman fuse-overlayfs && \ - ln -s /usr/bin/podman /usr/bin/docker && \ - yum -y clean all --enablerepo='*' - -COPY storage.conf /etc/containers/storage.conf -COPY containers.conf /etc/containers/containers.conf +RUN apt-get install -y podman && apt-get clean autoclean +RUN ln -s /usr/bin/podman /usr/bin/docker VOLUME /var/lib/containers From 39aa555a338f027060046ffd7239200614514aee Mon Sep 17 00:00:00 2001 From: jackyu Date: Wed, 11 Dec 2024 10:23:41 +0800 Subject: [PATCH 2/3] upgrade nodejs version to v16.20.2 --- nodejs/Dockerfile | 48 +++++++--------------------------------- nodejs/podman/Dockerfile | 48 +++++++--------------------------------- 2 files changed, 16 insertions(+), 80 deletions(-) diff --git a/nodejs/Dockerfile b/nodejs/Dockerfile index 183fe0f..57b1747 100644 --- a/nodejs/Dockerfile +++ b/nodejs/Dockerfile @@ -1,43 +1,11 @@ -FROM kubespheredev/builder-base:v3.1.0 +FROM kubespheredev/builder-base:v4.1.0 -ENV NODE_VERSION 10.16.3 +ENV NODE_VERSION v16.20.2 -RUN ARCH= && uArch="$(uname -m)" \ - && case "${uArch##*-}" in \ - x86_64) ARCH='x64';; \ - aarch64) ARCH='arm64';; \ - *) echo "unsupported architecture"; exit 1 ;; \ - esac \ - # gpg keys listed at https://github.com/nodejs/node#release-keys - && set -ex \ - && for key in \ - 4ED778F539E3634C779C87C6D7062848A1AB005C \ - 141F07595B7B3FFE74309A937405533BE57C7D57 \ - 74F12602B6F1C4E913FAA37AD3A89613643B6201 \ - 61FC681DFB92A079F1685E77973F295594EC4689 \ - 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ - C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ - 890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \ - C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \ - 108F52B48DB57BB0CC439B2997B01419BD92F80A \ - ; do \ - gpg --batch --keyserver sks.srv.dumain.com --recv-keys "$key"; \ - done \ - && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ - && curl -fsSLO https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt \ - && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ - && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ - && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt \ - && ln -s /usr/local/bin/node /usr/local/bin/nodejs \ - && yum install -y nodejs gcc-c++ make bzip2 GConf2 gtk2 chromedriver chromium xorg-x11-server-Xvfb +RUN curl -fsSL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh && \ + bash nodesource_setup.sh && \ + apt-get install nodejs -y && \ + node -v && npm -v -RUN npm -g config set user root -RUN npm i -g watch-cli vsce typescript - -# Yarn -ENV YARN_VERSION 1.16.0 -RUN curl -f -L -o /tmp/yarn.tgz https://github.com/yarnpkg/yarn/releases/download/v${YARN_VERSION}/yarn-v${YARN_VERSION}.tar.gz && \ - tar xf /tmp/yarn.tgz && \ - mv yarn-v${YARN_VERSION} /opt/yarn && \ - ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn && \ - yarn config set cache-folder /root/.yarn +RUN npm install -g yarn && \ + yarn config set cache-folder /root/.yarn diff --git a/nodejs/podman/Dockerfile b/nodejs/podman/Dockerfile index a91fb7d..24d8d44 100644 --- a/nodejs/podman/Dockerfile +++ b/nodejs/podman/Dockerfile @@ -1,43 +1,11 @@ -FROM kubespheredev/builder-base:v3.1.0-podman +FROM kubespheredev/builder-base:v4.1.0-podman -ENV NODE_VERSION 10.16.3 +ENV NODE_VERSION v16.20.2 -RUN ARCH= && uArch="$(uname -m)" \ - && case "${uArch##*-}" in \ - x86_64) ARCH='x64';; \ - aarch64) ARCH='arm64';; \ - *) echo "unsupported architecture"; exit 1 ;; \ - esac \ - # gpg keys listed at https://github.com/nodejs/node#release-keys - && set -ex \ - && for key in \ - 4ED778F539E3634C779C87C6D7062848A1AB005C \ - 141F07595B7B3FFE74309A937405533BE57C7D57 \ - 74F12602B6F1C4E913FAA37AD3A89613643B6201 \ - 61FC681DFB92A079F1685E77973F295594EC4689 \ - 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ - C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ - 890C08DB8579162FEE0DF9DB8BEAB4DFCF555EF4 \ - C82FA3AE1CBEDC6BE46B9360C43CEC45C17AB93C \ - 108F52B48DB57BB0CC439B2997B01419BD92F80A \ - ; do \ - gpg --batch --keyserver sks.srv.dumain.com --recv-keys "$key"; \ - done \ - && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ - && curl -fsSLO https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt \ - && grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ - && tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ - && rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt \ - && ln -s /usr/local/bin/node /usr/local/bin/nodejs \ - && yum install -y nodejs gcc-c++ make bzip2 GConf2 gtk2 chromedriver chromium xorg-x11-server-Xvfb +RUN curl -fsSL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh && \ + bash nodesource_setup.sh && \ + apt-get install nodejs -y && \ + node -v && npm -v -RUN npm -g config set user root -RUN npm i -g watch-cli vsce typescript - -# Yarn -ENV YARN_VERSION 1.16.0 -RUN curl -f -L -o /tmp/yarn.tgz https://github.com/yarnpkg/yarn/releases/download/v${YARN_VERSION}/yarn-v${YARN_VERSION}.tar.gz && \ - tar xf /tmp/yarn.tgz && \ - mv yarn-v${YARN_VERSION} /opt/yarn && \ - ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn && \ - yarn config set cache-folder /root/.yarn +RUN npm install -g yarn && \ + yarn config set cache-folder /root/.yarn From 950115b9236accf7cf3a8cc6b0e60d20364a62db Mon Sep 17 00:00:00 2001 From: jackyu Date: Wed, 11 Dec 2024 10:24:08 +0800 Subject: [PATCH 3/3] upgrade python version to 3.10.12 --- python/Dockerfile | 22 +++------------------- python/podman/Dockerfile | 22 +++------------------- 2 files changed, 6 insertions(+), 38 deletions(-) diff --git a/python/Dockerfile b/python/Dockerfile index bbe20c1..a793a4a 100644 --- a/python/Dockerfile +++ b/python/Dockerfile @@ -1,22 +1,6 @@ -FROM kubespheredev/builder-base:v3.1.0 +FROM kubespheredev/builder-base:v4.1.0 -# python3 -ENV PYTHON_VERSION=3.7.11 -RUN yum -y install bzip2-devel libffi-devel libsqlite3x-devel && \ - curl -fSL https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz -o /usr/src/Python-${PYTHON_VERSION}.tgz && \ - tar xzf /usr/src/Python-${PYTHON_VERSION}.tgz -C /usr/src/ --no-same-owner && \ - cd /usr/src/Python-${PYTHON_VERSION} && \ - ./configure --enable-optimizations --with-ensurepip=install --enable-loadable-sqlite-extensions && \ - make altinstall -j 2 && \ - cd ../ && \ - rm -rf /usr/src/Python-${PYTHON_VERSION}.tgz /usr/src/Python-${PYTHON_VERSION} && \ - ln -fs /usr/local/bin/python3.7 /usr/bin/python && \ - ln -fs /usr/local/bin/python3.7 /usr/bin/python3 && \ - ln -fs /usr/local/bin/pip3.7 /usr/bin/pip && \ - python3 -m pip install --upgrade pip && \ - sed -e 's|^#!/usr/bin/python|#!/usr/bin/python2.7|g' -i.bak /usr/bin/yum && \ - sed -e 's|^#! /usr/bin/python|#! /usr/bin/python2.7|g' -i.bak /usr/libexec/urlgrabber-ext-down && \ - yum -y remove bzip2-devel libffi-devel libsqlite3x-devel && \ - yum -y clean all +# python:3.10.12 pip:22.0.2 +RUN apt-get install -y python3 pip && apt-get clean autoclean && ln -s /usr/bin/python3 /usr/bin/python CMD ["python","--version"] diff --git a/python/podman/Dockerfile b/python/podman/Dockerfile index 112bda2..93c8871 100644 --- a/python/podman/Dockerfile +++ b/python/podman/Dockerfile @@ -1,22 +1,6 @@ -FROM kubespheredev/builder-base:v3.1.0-podman +FROM kubespheredev/builder-base:v4.1.0-podman -# python3 -ENV PYTHON_VERSION=3.7.11 -RUN yum -y install bzip2-devel libffi-devel libsqlite3x-devel && \ - curl -fSL https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz -o /usr/src/Python-${PYTHON_VERSION}.tgz && \ - tar xzf /usr/src/Python-${PYTHON_VERSION}.tgz -C /usr/src/ --no-same-owner && \ - cd /usr/src/Python-${PYTHON_VERSION} && \ - ./configure --enable-optimizations --with-ensurepip=install --enable-loadable-sqlite-extensions && \ - make altinstall -j 2 && \ - cd ../ && \ - rm -rf /usr/src/Python-${PYTHON_VERSION}.tgz /usr/src/Python-${PYTHON_VERSION} && \ - ln -fs /usr/local/bin/python3.7 /usr/bin/python && \ - ln -fs /usr/local/bin/python3.7 /usr/bin/python3 && \ - ln -fs /usr/local/bin/pip3.7 /usr/bin/pip && \ - python3 -m pip install --upgrade pip && \ - sed -e 's|^#!/usr/bin/python|#!/usr/bin/python2.7|g' -i.bak /usr/bin/yum && \ - sed -e 's|^#! /usr/bin/python|#! /usr/bin/python2.7|g' -i.bak /usr/libexec/urlgrabber-ext-down && \ - yum -y remove bzip2-devel libffi-devel libsqlite3x-devel && \ - yum -y clean all +# python:3.10.12 pip:22.0.2 +RUN apt-get install -y python3 pip && apt-get clean autoclean && ln -s /usr/bin/python3 /usr/bin/python CMD ["python","--version"]