This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## [0.10.0] - 2020-03-12 | ||
- 添加 sonar-scanner 支持 | ||
- 更新 `yq`、`helm`、`helm-push`、`kaniko` 版本 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,47 @@ | ||
FROM gcr.azk8s.cn/kaniko-project/executor:v0.15.0 | ||
FROM gcr.azk8s.cn/kaniko-project/executor:v0.18.0 AS kaniko | ||
FROM dockerhub.azk8s.cn/sonarsource/sonar-scanner-cli:4.3 AS sonar-scanner-cli | ||
FROM dockerhub.azk8s.cn/library/maven:3-jdk-8-alpine | ||
|
||
ENV SONAR_SCANNER_HOME="/opt/sonar-scanner" \ | ||
SONAR_SCANNER_VERSION="4.3.0.2102" | ||
|
||
ENV TZ="Asia/Shanghai" \ | ||
YQ_VERSION="2.4.0" \ | ||
YQ_VERSION="3.2.1" \ | ||
IMG_VERSION="v0.5.7" \ | ||
HELM_VERSION="v2.14.1" \ | ||
HELM_VERSION="v2.16.3" \ | ||
DOCKER_VERSION="18.06.3" \ | ||
HELM_PUSH_VERSION="v0.7.1" \ | ||
YQ_SHA256="99a01ae32f0704773c72103adb7050ef5c5cad14b517a8612543821ef32d6cc9" \ | ||
DOCKER_SHA256="346f9394393ee8db5f8bd1e229ee9d90e5b36931bdd754308b2ae68884dd6822" | ||
HELM_PUSH_VERSION="v0.8.1" \ | ||
YQ_SHA256="11a830ffb72aad0eaa7640ef69637068f36469be4f68a93da822fbe454e998f8" \ | ||
DOCKER_SHA256="346f9394393ee8db5f8bd1e229ee9d90e5b36931bdd754308b2ae68884dd6822" \ | ||
PATH="${SONAR_SCANNER_HOME}/bin:${PATH}" | ||
|
||
# Add mirror source | ||
RUN cp /etc/apk/repositories /etc/apk/repositories.bak && \ | ||
sed -i 's dl-cdn.alpinelinux.org mirrors.aliyun.com g' /etc/apk/repositories | ||
|
||
# Install kaniko | ||
COPY --from=0 /kaniko/executor /usr/bin/kaniko | ||
# Install kaniko sonar-scanner-cli | ||
COPY --from=kaniko /kaniko/executor /usr/bin/kaniko | ||
COPY --from=sonar-scanner-cli /opt/sonar-scanner/bin /opt/sonar-scanner/bin | ||
COPY --from=sonar-scanner-cli /opt/sonar-scanner/conf /opt/sonar-scanner/conf | ||
COPY --from=sonar-scanner-cli /opt/sonar-scanner/lib /opt/sonar-scanner/lib | ||
|
||
# Install base packages | ||
RUN apk --no-cache add \ | ||
xz \ | ||
jq \ | ||
git \ | ||
npm \ | ||
yarn \ | ||
unzip \ | ||
python \ | ||
py-pip \ | ||
xmlstarlet \ | ||
mysql-client \ | ||
ca-certificates && \ | ||
# install pylint | ||
pip install -U --no-cache-dir pylint && \ | ||
# don't use embedded jre | ||
sed -i '/use_embedded_jre=true/d' /opt/sonar-scanner/bin/sonar-scanner && \ | ||
# install docker client | ||
wget -qO "/tmp/docker-${DOCKER_VERSION}-ce.tgz" \ | ||
"https://mirror.azure.cn/docker-ce/linux/static/stable/x86_64/docker-${DOCKER_VERSION}-ce.tgz" && \ | ||
|
@@ -43,13 +60,14 @@ RUN apk --no-cache add \ | |
echo "${IMG_SHA256} /usr/bin/img" | sha256sum -c - && \ | ||
chmod a+x /usr/bin/img && \ | ||
# install helm | ||
HELM_SHA256=`curl -sSL "https://mirror.azure.cn/kubernetes/helm/helm-${HELM_VERSION}-linux-amd64.tar.gz.sha256"` && \ | ||
HELM_SHA256=`curl -sSL "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz.sha256"` && \ | ||
wget -qO "/tmp/helm-${HELM_VERSION}-linux-amd64.tar.gz" \ | ||
"https://mirror.azure.cn/kubernetes/helm/helm-${HELM_VERSION}-linux-amd64.tar.gz" && \ | ||
"https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz" && \ | ||
echo "${HELM_SHA256} /tmp/helm-${HELM_VERSION}-linux-amd64.tar.gz" | sha256sum -c - && \ | ||
tar xzf "/tmp/helm-${HELM_VERSION}-linux-amd64.tar.gz" -C /tmp && \ | ||
mv /tmp/linux-amd64/helm /usr/bin/helm && \ | ||
# post install | ||
rm -r /tmp/* && \ | ||
helm init -c --stable-repo-url=https://mirror.azure.cn/kubernetes/charts/ && \ | ||
helm plugin install --version $HELM_PUSH_VERSION https://github.com/chartmuseum/helm-push | ||
helm plugin install --version $HELM_PUSH_VERSION https://github.com/chartmuseum/helm-push && \ | ||
npm install -g [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,30 @@ | ||
FROM gcr.azk8s.cn/kaniko-project/executor:v0.15.0 | ||
FROM dockerhub.azk8s.cn/library/maven:3.5.2-jdk-8-slim | ||
FROM gcr.azk8s.cn/kaniko-project/executor:v0.18.0 AS kaniko | ||
FROM dockerhub.azk8s.cn/sonarsource/sonar-scanner-cli:4.3 AS sonar-scanner-cli | ||
FROM dockerhub.azk8s.cn/library/maven:3-jdk-8-slim | ||
|
||
ENV SONAR_SCANNER_HOME="/opt/sonar-scanner" \ | ||
SONAR_SCANNER_VERSION="4.3.0.2102" | ||
|
||
ENV TZ="Asia/Shanghai" \ | ||
YQ_VERSION="2.4.0" \ | ||
YQ_VERSION="3.2.1" \ | ||
IMG_VERSION="v0.5.7" \ | ||
HELM_VERSION="v2.14.1" \ | ||
HELM_VERSION="v2.16.3" \ | ||
DOCKER_VERSION="18.06.3" \ | ||
HELM_PUSH_VERSION="v0.7.1" \ | ||
YQ_SHA256="99a01ae32f0704773c72103adb7050ef5c5cad14b517a8612543821ef32d6cc9" \ | ||
HELM_PUSH_VERSION="v0.8.1" \ | ||
YQ_SHA256="11a830ffb72aad0eaa7640ef69637068f36469be4f68a93da822fbe454e998f8" \ | ||
DOCKER_SHA256="346f9394393ee8db5f8bd1e229ee9d90e5b36931bdd754308b2ae68884dd6822" | ||
PATH="${SONAR_SCANNER_HOME}/bin:${PATH}" | ||
|
||
# Add mirror source | ||
RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak && \ | ||
sed -i 's deb.debian.org mirrors.aliyun.com g' /etc/apt/sources.list | ||
|
||
# Install kaniko | ||
COPY --from=0 /kaniko/executor /usr/bin/kaniko | ||
# Install kaniko sonar-scanner-cli | ||
COPY --from=kaniko /kaniko/executor /usr/bin/kaniko | ||
COPY --from=sonar-scanner-cli /opt/sonar-scanner/bin /opt/sonar-scanner/bin | ||
COPY --from=sonar-scanner-cli /opt/sonar-scanner/conf /opt/sonar-scanner/conf | ||
COPY --from=sonar-scanner-cli /opt/sonar-scanner/lib /opt/sonar-scanner/lib | ||
|
||
# Install base packages | ||
RUN apt-get update && apt-get install -y \ | ||
jq \ | ||
|
@@ -23,12 +33,17 @@ RUN apt-get update && apt-get install -y \ | |
tar \ | ||
curl \ | ||
wget \ | ||
unzip \ | ||
pylint \ | ||
gnupg2 \ | ||
python \ | ||
xz-utils \ | ||
xmlstarlet \ | ||
mysql-client \ | ||
ca-certificates \ | ||
apt-transport-https && \ | ||
# don't use embedded jre | ||
sed -i '/use_embedded_jre=true/d' /opt/sonar-scanner/bin/sonar-scanner && \ | ||
# Install nodejs | ||
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ | ||
echo 'deb https://deb.nodesource.com/node_11.x stretch main' > /etc/apt/sources.list.d/nodesource.list && \ | ||
|
@@ -59,14 +74,15 @@ RUN apt-get update && apt-get install -y \ | |
echo "${IMG_SHA256} /usr/bin/img" | sha256sum -c - && \ | ||
chmod a+x /usr/bin/img && \ | ||
# install helm | ||
HELM_SHA256=`curl -sSL "https://mirror.azure.cn/kubernetes/helm/helm-${HELM_VERSION}-linux-amd64.tar.gz.sha256"` && \ | ||
HELM_SHA256=`curl -sSL "https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz.sha256"` && \ | ||
wget -qO "/tmp/helm-${HELM_VERSION}-linux-amd64.tar.gz" \ | ||
"https://mirror.azure.cn/kubernetes/helm/helm-${HELM_VERSION}-linux-amd64.tar.gz" && \ | ||
"https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz" && \ | ||
echo "${HELM_SHA256} /tmp/helm-${HELM_VERSION}-linux-amd64.tar.gz" | sha256sum -c - && \ | ||
tar xzf "/tmp/helm-${HELM_VERSION}-linux-amd64.tar.gz" -C /tmp && \ | ||
mv /tmp/linux-amd64/helm /usr/bin/helm && \ | ||
# post install | ||
rm -r /tmp/* && \ | ||
helm init -c --stable-repo-url=https://mirror.azure.cn/kubernetes/charts/ && \ | ||
helm plugin install --version $HELM_PUSH_VERSION https://github.com/chartmuseum/helm-push && \ | ||
ln -s /usr/bin/xmlstarlet /usr/bin/xml | ||
ln -s /usr/bin/xmlstarlet /usr/bin/xml && \ | ||
npm install -g [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters