Skip to content

Commit

Permalink
replace base image centos by ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
yudong2015 committed Dec 11, 2024
1 parent db30007 commit f608b07
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 77 deletions.
62 changes: 27 additions & 35 deletions base/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 ./*
Expand Down
72 changes: 30 additions & 42 deletions base/podman/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit f608b07

Please sign in to comment.