Skip to content

Commit

Permalink
feat(dockerfiles/ci/base): update ci base image
Browse files Browse the repository at this point in the history
Signed-off-by: wuhuizuo <wuhuizuo@126.com>
  • Loading branch information
wuhuizuo committed Sep 24, 2024
1 parent 84787ec commit 1d63d34
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-ci-runtime-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
module: [base]
platform: [linux/amd64, linux/arm64]
builder-profile: [local-docker]
go-profile: [go-1.21, go-1.20, go-1.19]
go-profile: [go-1.23, go-1.22, go-1.21]

steps:
- name: Checkout sources
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-ci-runtime-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
matrix:
module: [base]
builder-profile: [local-docker]
go-profile: [go-1.21, go-1.20, go-1.19]
go-profile: [go-1.23, go-1.22, go-1.11]

steps:
- name: Checkout sources
Expand Down
99 changes: 51 additions & 48 deletions dockerfiles/ci/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,72 +1,75 @@
# Base image
# renovate: datasource=docker depName=golang
ARG GOLANG_VERSION=1.23.1
FROM golang:${GOLANG_VERSION}
########### stage: builder
FROM quay.io/rockylinux/rockylinux:8.10.20240528

LABEL go-version "${GOLANG_VERSION}"
LABEL org.opencontainers.image.authors "wuhui.zuo@pingcap.com"
LABEL org.opencontainers.image.description "CI Base image for building/testing"
LABEL org.opencontainers.image.source "https://github.com/PingCAP-QE/artifacts"

# install packages.
RUN apt-get update && \
apt-get install -y build-essential wget unzip psmisc lsof jq mariadb-client && \
apt-get clean

# rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y --default-toolchain nightly
ENV PATH /root/.cargo/bin:$PATH
# setup mariadb repo
# ref: https://mariadb.com/docs/server/connect/clients/mariadb-client/#Linux_(Repository)
RUN curl -LsSO https://r.mariadb.com/downloads/mariadb_repo_setup \
&& echo "6083ef1974d11f49d42ae668fb9d513f7dc2c6276ffa47caed488c4b47268593 mariadb_repo_setup" | sha256sum -c - \
&& chmod +x mariadb_repo_setup \
&& ./mariadb_repo_setup \
&& rm mariadb_repo_setup

##### install tools: bazelisk, yq, oras, codecov, gradle, apache-maven
# renovate: datasource=github-tags depName=bazelbuild/bazelisk
ARG BAZELISK_VERSION=v1.20.0
RUN OS=linux; ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
curl -fsSL "https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-${OS}-${ARCH}" -o /usr/local/bin/bazel && chmod +x /usr/local/bin/bazel
# install OS packages.
RUN --mount=type=cache,target=/var/cache/dnf \
dnf upgrade-minimal -y && \
dnf install -y make git gcc wget unzip psmisc lsof jq MariaDB-client

# yq tool
# renovate: datasource=github-tags depName=mikefarah/yq
ARG YQ_VERSION=v4.44.3
# install golang toolchain
# renovate: datasource=docker depName=golang
ARG GOLANG_VERSION=1.23.1
RUN OS=linux; ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
curl -fsSL "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_${OS}_${ARCH}" -o /usr/local/bin/yq && chmod +x /usr/local/bin/yq

# oras tool
# renovate: datasource=github-tags depName=oras-project/oras
COPY --from=bitnami/oras:1.2.0 /oras /usr/local/bin/oras
curl -fsSL https://dl.google.com/go/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz | tar -C /usr/local -xz
ENV PATH /usr/local/go/bin/:$PATH
LABEL go-version="${GOLANG_VERSION}"

# codecov tool
# renovate: datasource=github-tags depName=codecov/uploader
ARG CODECOV_VERSION=v0.8.0
RUN folder=$([ "$(arch)" = "x86_64" ] && echo linux || echo aarch64); \
curl -fsSL https://uploader.codecov.io/${CODECOV_VERSION}/${folder}/codecov -o /usr/local/bin/codecov && \
chmod +x /usr/local/bin/codecov
# install rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y --default-toolchain nightly
ENV PATH /root/.cargo/bin:$PATH

# java tool chains -> open-jdk
ARG OPENJDK_VER=17
RUN apt-get update && apt-get install -y openjdk-${OPENJDK_VER}-jdk && apt-get clean
RUN ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); cd /usr/lib/jvm/ && ln -s java-${OPENJDK_VER}-openjdk-${ARCH} java-17-openjdk
ENV JAVA_HOME=/usr/lib/jvm/java-${OPENJDK_VER}-openjdk
# install nodejs toolchain
ARG NODE_VERSION=18
RUN curl -fsSL https://rpm.nodesource.com/setup_${NODE_VERSION}.x | bash - \
&& dnf install -y nsolid \
&& npm install -g yarn@1.22.22 pnpm@8.15.9

# java tool chains -> gradle
# java tool chains: open-jdk, gradle, apache-maven
# -> open-jdk
ARG JAVA_VER=17
RUN --mount=type=cache,target=/var/cache/dnf \
dnf install -y java-${JAVA_VER}-openjdk
# RUN ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); cd /usr/lib/jvm/ && ln -s java-${OPENJDK_VER}-openjdk-${ARCH} java-17-openjdk
# ENV JAVA_HOME=/usr/lib/jvm/java-${OPENJDK_VER}-openjdk
# -> gradle
ARG GRADLE_VER=7.4.2
RUN wget https://services.gradle.org/distributions/gradle-${GRADLE_VER}-bin.zip && \
unzip gradle-${GRADLE_VER}-bin.zip -d /opt && \
rm gradle-${GRADLE_VER}-bin.zip
ENV PATH=$PATH:/opt/gradle-${GRADLE_VER}/bin

# java tool chains -> apache-maven
# -> apache-maven
ARG MAVEN_VER=3.8.8
RUN wget https://downloads.apache.org/maven/maven-3/${MAVEN_VER}/binaries/apache-maven-${MAVEN_VER}-bin.tar.gz && \
tar -xf apache-maven-${MAVEN_VER}-bin.tar.gz -C /opt && \
rm apache-maven-${MAVEN_VER}-bin.tar.gz
ENV PATH=$PATH:/opt/apache-maven-${MAVEN_VER}/bin

# install nodejs toolchain
ARG NODE_VERSION=16
RUN curl -sL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && \
apt-get install -y nodejs && \
apt-get clean && \
npm install -g yarn pnpm
#### install tools: bazelisk, codecov, oras
# renovate: datasource=github-tags depName=bazelbuild/bazelisk
ARG BAZELISK_VERSION=v1.20.0
RUN OS=linux; ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
curl -fsSL "https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_VERSION}/bazelisk-${OS}-${ARCH}" -o /usr/local/bin/bazel && chmod +x /usr/local/bin/bazel

# Upgrade Git tool
# renovate: datasource=github-tags depName=git/git
COPY --from=bitnami/git:2.46.1 /opt/bitnami/git/bin/git /usr/bin/git
# codecov tool
# renovate: datasource=github-tags depName=codecov/uploader
ARG CODECOV_VERSION=v0.8.0
RUN folder=$([ "$(arch)" = "x86_64" ] && echo linux || echo aarch64); \
curl -fsSL https://uploader.codecov.io/${CODECOV_VERSION}/${folder}/codecov -o /usr/local/bin/codecov && \
chmod +x /usr/local/bin/codecov

# oras tool
# renovate: datasource=github-tags depName=oras-project/oras
COPY --from=bitnami/oras:1.2.0 /oras /usr/local/bin/oras
19 changes: 9 additions & 10 deletions dockerfiles/ci/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,36 +43,35 @@ profiles:
- op: move
from: /build/artifacts/0/kaniko
path: /build/artifacts/0/docker
- name: go-1.21
- name: go-1.23
patches:
- op: replace
path: /build/tagPolicy/customTemplate/template
value: "{{ .SHA }}-go1.21"
value: "{{ .SHA }}-go1.23"
- op: add
path: /build/artifacts/0/kaniko/buildArgs
value:
# renovate: datasource=docker depName=golang
GOLANG_VERSION: 1.21.13
- name: go-1.20
GOLANG_VERSION: 1.23.1
- name: go-1.22
patches:
- op: replace
path: /build/tagPolicy/customTemplate/template
value: "{{ .SHA }}-go1.20"
value: "{{ .SHA }}-go1.22"
- op: add
path: /build/artifacts/0/kaniko/buildArgs
value:
# renovate: datasource=docker depName=golang
GOLANG_VERSION: 1.20.14
- name: go-1.19
GOLANG_VERSION: 1.22.7
- name: go-1.21
patches:
- op: replace
path: /build/tagPolicy/customTemplate/template
value: "{{ .SHA }}-go1.19"
value: "{{ .SHA }}-go1.21"
- op: add
path: /build/artifacts/0/kaniko/buildArgs
value:
# renovate: datasource=docker depName=golang
GOLANG_VERSION: 1.19.13
GOLANG_VERSION: 1.21.13 # EOL
---
apiVersion: skaffold/v4beta6
kind: Config
Expand Down

0 comments on commit 1d63d34

Please sign in to comment.