Skip to content

Commit

Permalink
Migrate linux builder OS from CentOS 7 to RockyLinux 8 (#381)
Browse files Browse the repository at this point in the history
Fixes #379

---------

Signed-off-by: wuhuizuo <wuhuizuo@126.com>
  • Loading branch information
wuhuizuo authored Sep 2, 2024
1 parent 365093a commit 8a12cd0
Show file tree
Hide file tree
Showing 12 changed files with 148 additions and 228 deletions.
23 changes: 2 additions & 21 deletions .github/workflows/pull-cd-builder-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,10 @@ jobs:

strategy:
matrix:
# module: [builder-others, builder-tikv, builder-tikv-fips, builder-others-slow]
module: [builder-others, builder-tikv, builder-tikv-fips]
module: [builder-others, builder-tikv, builder-tikv-fips, builder-others-slow]
# module: [builder-others, builder-tikv, builder-tikv-fips]
platform: [linux/amd64, linux/arm64]
builder-profile: [local-docker]
include:
- module: builder-tikv
builder-profile: devtoolset8,local-docker
platform: linux/amd64
- module: builder-tikv
builder-profile: devtoolset9,local-docker
platform: linux/amd64
- module: builder-tikv
builder-profile: devtoolset10,local-docker
platform: linux/amd64
- module: builder-tikv
builder-profile: devtoolset8,local-docker
platform: linux/arm64
- module: builder-tikv
builder-profile: devtoolset9,local-docker
platform: linux/arm64
- module: builder-tikv
builder-profile: devtoolset10,local-docker
platform: linux/arm64
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/release-cd-builder-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,6 @@ jobs:
# module: [builder-others, builder-tikv, builder-tikv-fips, builder-others-slow]
module: [builder-others, builder-tikv, builder-tikv-fips]
builder-profile: [local-docker]
include:
- module: builder-tikv
builder-profile: devtoolset8,local-docker
- module: builder-tikv
builder-profile: devtoolset9,local-docker
- module: builder-tikv
builder-profile: devtoolset10,local-docker
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand Down
29 changes: 12 additions & 17 deletions dockerfiles/cd/builders/ng-monitoring/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,20 @@
# - docker >= v20.10
#
# build steps:
# - git clone https://github.com/pingcap/tidb.git tidb
# - rm tidb/.dockerignore # make step depended on git metadata.
# - docker build -t tidb -f Dockerfile ./tidb
# - git clone https://github.com/pingcap/ng-monitoring.git ng-monitoring
# - rm ng-monitoring/.dockerignore # make step depended on git metadata.
# - docker build -t ng-monitoring -f Dockerfile ./ng-monitoring

########### stage: Builder
FROM centos:7.9.2009 as builder
# CentOS 7 has reached EOL
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
########### stage: builder
FROM quay.io/rockylinux/rockylinux:8.10.20240528 as builder
LABEL org.opencontainers.image.authors "wuhui.zuo@pingcap.com"
LABEL org.opencontainers.image.description "binary builder for NG-Monitoring"
LABEL org.opencontainers.image.source = "https://github.com/PingCAP-QE/artifacts"

# install packages.
RUN yum update --nogpgcheck -y && \
yum install --nogpgcheck -y epel-release deltarpm && \
yum update --nogpgcheck -y && \
yum groupinstall --nogpgcheck -y "Development Tools" && \
yum install -y wget && \
yum clean all
RUN --mount=type=cache,target=/var/cache/dnf \
dnf upgrade-minimal -y && \
dnf install -y make git gcc

# install golang toolchain
# renovate: datasource=docker depName=golang
Expand All @@ -29,7 +25,7 @@ RUN OS=linux; ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
ENV PATH /usr/local/go/bin/:$PATH
LABEL go-version="${GOLANG_VERSION}"

########### stage: Buiding
########### stage: building
FROM builder as building
COPY . /ws
ARG GOPROXY
Expand All @@ -38,7 +34,6 @@ RUN /ws/bin/ng-monitoring-server -V

########### stage: Final image
FROM ghcr.io/pingcap-qe/bases/ng-monitoring-base:v1.9.1

COPY --from=building /ws/bin/ng-monitoring-server /ng-monitoring-server

WORKDIR /
Expand Down
41 changes: 18 additions & 23 deletions dockerfiles/cd/builders/pd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,39 @@
# - git clone --recurse-submodules https://github.com/tikv/pd.git pd
# - docker build -t pd -f Dockerfile ./pd

########### stage: Builder
FROM centos:7.9.2009 as builder
# CentOS 7 has reached EOL
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
########### stage: builder
FROM quay.io/rockylinux/rockylinux:8.10.20240528 as builder
LABEL org.opencontainers.image.authors "wuhui.zuo@pingcap.com"
LABEL org.opencontainers.image.description "binary builder for PD"
LABEL org.opencontainers.image.source = "https://github.com/PingCAP-QE/artifacts"

# install packages.
RUN yum update --nogpgcheck -y && \
yum install --nogpgcheck -y epel-release deltarpm && \
yum update --nogpgcheck -y && \
yum groupinstall --nogpgcheck -y "Development Tools" && \
yum install --nogpgcheck -y which && \
yum clean all
RUN --mount=type=cache,target=/var/cache/dnf \
dnf upgrade-minimal -y && \
dnf install -y make git gcc which unzip

# install golang toolchain
# renovate: datasource=docker depName=golang
ARG GOLANG_VERSION=1.21.6
ARG GOLANG_VERSION=1.21.13
RUN OS=linux; ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
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}"

########### stage: Buiding
########### stage: building
FROM builder as building
COPY . /pd
COPY . /ws
ARG GOPROXY
RUN GOPROXY=${GOPROXY} make build tools -C /pd
RUN /pd/bin/pd-server -V
RUN /pd/bin/pd-ctl -V
RUN /pd/bin/pd-recover -V
RUN GOPROXY=${GOPROXY} make build tools -C /ws
RUN /ws/bin/pd-server -V
RUN /ws/bin/pd-ctl -V
RUN /ws/bin/pd-recover -V

########### stage: Final image
FROM ghcr.io/pingcap-qe/bases/pd-base:v1.9.1

COPY --from=building /pd/bin/pd-server /pd-server
COPY --from=building /pd/bin/pd-ctl /pd-ctl
COPY --from=building /pd/bin/pd-recover /pd-recover
COPY --from=building /ws/bin/pd-server /pd-server
COPY --from=building /ws/bin/pd-ctl /pd-ctl
COPY --from=building /ws/bin/pd-recover /pd-recover

EXPOSE 2379 2380
ENTRYPOINT ["/pd-server"]
Expand Down
27 changes: 0 additions & 27 deletions dockerfiles/cd/builders/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,33 +193,6 @@ profiles:
tryImportMissing: true
patches:
- { op: move, from: /build/artifacts/0/kaniko, path: /build/artifacts/0/docker }
- name: devtoolset8
patches:
- op: replace
path: /build/tagPolicy/customTemplate/template
value: "{{ .SHA }}-devtoolset8"
- op: add
path: /build/artifacts/0/kaniko/buildArgs
value:
DEVTOOLSET_VER: 8
- name: devtoolset9
patches:
- op: replace
path: /build/tagPolicy/customTemplate/template
value: "{{ .SHA }}-devtoolset9"
- op: add
path: /build/artifacts/0/kaniko/buildArgs
value:
DEVTOOLSET_VER: 9
- name: devtoolset10
patches:
- op: replace
path: /build/tagPolicy/customTemplate/template
value: "{{ .SHA }}-devtoolset10"
- op: add
path: /build/artifacts/0/kaniko/buildArgs
value:
DEVTOOLSET_VER: 10
---
apiVersion: skaffold/v4beta6
kind: Config
Expand Down
30 changes: 14 additions & 16 deletions dockerfiles/cd/builders/tidb-dashboard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@
# - docker >= v20.10
#
# build steps:
# - git clone https://github.com/pingcap/tidb.git tidb
# - rm tidb/.dockerignore # make step depended on git metadata.
# - docker build -t tidb -f Dockerfile ./tidb
# - git clone https://github.com/pingcap/tidb-dashbord.git tidb-dashbord
# - rm tidb-dashbord/.dockerignore # make step depended on git metadata.
# - docker build -t tidb-dashbord -f Dockerfile ./tidb-dashbord

########### stage: Builder
FROM centos:7.9.2009 as builder
# CentOS 7 has reached EOL
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
########### stage: builder
FROM quay.io/rockylinux/rockylinux:8.10.20240528-ubi as builder
LABEL org.opencontainers.image.authors "wuhui.zuo@pingcap.com"
LABEL org.opencontainers.image.description "binary builder for TiDB Dashboard"
LABEL org.opencontainers.image.source = "https://github.com/PingCAP-QE/artifacts"

# install packages.
RUN yum -y update && \
yum -y groupinstall "Development Tools" && \
yum -y install java-11-openjdk && \
yum clean all
RUN --mount=type=cache,target=/var/cache/dnf \
dnf upgrade-minimal -y && \
dnf install -y make git gcc java-11-openjdk findutils

# install golang toolchain
# renovate: datasource=docker depName=golang
Expand All @@ -28,11 +26,11 @@ ENV PATH /usr/local/go/bin/:$PATH
LABEL go-version="${GOLANG_VERSION}"

# Install nodejs.
RUN curl -fsSL https://rpm.nodesource.com/setup_16.x | bash -
RUN curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -
RUN yum -y install nodejs && yum clean all
RUN npm install -g pnpm@7.30.5
RUN npm install -g pnpm@9.7.0

########### stage: Buiding
########### stage: building
FROM builder as building
COPY . /ws
ARG GOPROXY
Expand Down
9 changes: 6 additions & 3 deletions dockerfiles/cd/builders/tidb-operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@
# - rm tidb-operator/.dockerignore # make step depended on git metadata.
# - docker build -t tidb-operator -f Dockerfile ./tidb-operator

########### stage: Builder
########### stage: builder
ARG GOLANG_VERSION=1.21.13
FROM golang:${GOLANG_VERSION} as builder
LABEL org.opencontainers.image.authors "wuhui.zuo@pingcap.com"
LABEL org.opencontainers.image.description "binary builder for TiDB Operator"
LABEL org.opencontainers.image.source = "https://github.com/PingCAP-QE/artifacts"
LABEL go-version="${GOLANG_VERSION}"

# install packages.
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && apt-get install -y uuid-runtime

LABEL go-version="${GOLANG_VERSION}"

########### stage: Buiding
########### stage: building
FROM builder as building
COPY . /ws
ARG GOPROXY
Expand Down
30 changes: 13 additions & 17 deletions dockerfiles/cd/builders/tidb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@
# - rm tidb/.dockerignore # make step depended on git metadata.
# - docker build -t tidb -f Dockerfile ./tidb

########### stage: Builder
FROM centos:7.9.2009 as builder
# CentOS 7 has reached EOL
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
########### stage: builder
FROM quay.io/rockylinux/rockylinux:8.10.20240528 as builder
LABEL org.opencontainers.image.authors "wuhui.zuo@pingcap.com"
LABEL org.opencontainers.image.description "binary builder for TiDB"
LABEL org.opencontainers.image.source = "https://github.com/PingCAP-QE/artifacts"

# install packages.
RUN yum update --nogpgcheck -y && \
yum install --nogpgcheck -y epel-release deltarpm && \
yum update --nogpgcheck -y && \
yum groupinstall --nogpgcheck -y "Development Tools" && \
yum clean all
RUN --mount=type=cache,target=/var/cache/dnf \
dnf upgrade-minimal -y && \
dnf install -y make git gcc

# install golang toolchain
# renovate: datasource=docker depName=golang
Expand All @@ -28,17 +25,16 @@ RUN OS=linux; ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
ENV PATH /usr/local/go/bin/:$PATH
LABEL go-version="${GOLANG_VERSION}"

########### stage: Buiding
########### stage: building
FROM builder as building
COPY . /tidb
COPY . /ws
ARG GOPROXY
RUN GOPROXY=${GOPROXY} make server -C /tidb
RUN /tidb/bin/tidb-server -V
RUN GOPROXY=${GOPROXY} make server -C /ws
RUN /ws/bin/tidb-server -V

########### stage: Final image
FROM ghcr.io/pingcap-qe/bases/tidb-base:v1.9.1

COPY --from=building /tidb/bin/tidb-server /tidb-server
COPY --from=building /ws/bin/tidb-server /tidb-server

WORKDIR /
EXPOSE 4000
Expand Down
Loading

0 comments on commit 8a12cd0

Please sign in to comment.