Skip to content

Commit

Permalink
refactor(dockerfiles/cd/builders): migrate builder base image from ce…
Browse files Browse the repository at this point in the history
…ntos 7 to rocky linux 8

The ones are compatible with centos 7
- ng-monitoring
- tidb
- tiflow

The ones are NOT compatible with centos 7
- pd
- tidb-dashboard

Signed-off-by: wuhuizuo <wuhuizuo@126.com>
  • Loading branch information
wuhuizuo committed Aug 14, 2024
1 parent 89a5b16 commit 33abf29
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 63 deletions.
13 changes: 7 additions & 6 deletions dockerfiles/cd/builders/ng-monitoring/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
# - rm ng-monitoring/.dockerignore # make step depended on git metadata.
# - docker build -t ng-monitoring -f Dockerfile ./ng-monitoring

########### stage: Builder
########### stage: builder
FROM quay.io/rockylinux/rockylinux:8.10.20240528 as builder

# install packages.
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
ARG GOLANG_VERSION=1.21.13
Expand All @@ -17,10 +22,7 @@ RUN OS=linux; ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
ENV PATH /usr/local/go/bin/:$PATH
LABEL go-version="${GOLANG_VERSION}"

# install packages.
RUN dnf install -y make git

########### stage: Buiding
########### stage: building
FROM builder as building
COPY . /ws
ARG GOPROXY
Expand All @@ -29,7 +31,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
29 changes: 15 additions & 14 deletions dockerfiles/cd/builders/pd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
# - git clone --recurse-submodules https://github.com/tikv/pd.git pd
# - docker build -t pd -f Dockerfile ./pd

########### stage: Builder
########### stage: builder
FROM quay.io/rockylinux/rockylinux:8.10.20240528 as builder

# install packages.
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.13
Expand All @@ -16,24 +21,20 @@ RUN OS=linux; ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
ENV PATH /usr/local/go/bin/:$PATH
LABEL go-version="${GOLANG_VERSION}"

# install packages.
RUN dnf install -y make git

########### 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
16 changes: 9 additions & 7 deletions dockerfiles/cd/builders/tidb-dashboard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
# - rm tidb/.dockerignore # make step depended on git metadata.
# - docker build -t tidb -f Dockerfile ./tidb

########### stage: Builder
FROM quay.io/rockylinux/rockylinux:8.10.20240528 as builder
########### stage: builder
FROM quay.io/rockylinux/rockylinux:8.10.20240528-ubi as builder

# install packages.
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 @@ -17,15 +22,12 @@ RUN OS=linux; ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
ENV PATH /usr/local/go/bin/:$PATH
LABEL go-version="${GOLANG_VERSION}"

# install packages.
RUN dnf install -y make git

# Install nodejs.
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
21 changes: 11 additions & 10 deletions dockerfiles/cd/builders/tidb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
# - rm tidb/.dockerignore # make step depended on git metadata.
# - docker build -t tidb -f Dockerfile ./tidb

########### stage: Builder
########### stage: builder
FROM quay.io/rockylinux/rockylinux:8.10.20240528 as builder

# install packages.
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
ARG GOLANG_VERSION=1.21.13
Expand All @@ -17,20 +22,16 @@ RUN OS=linux; ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
ENV PATH /usr/local/go/bin/:$PATH
LABEL go-version="${GOLANG_VERSION}"

# install packages.
RUN dnf install -y make git

########### 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
49 changes: 24 additions & 25 deletions dockerfiles/cd/builders/tiflow/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
# - git clone --recurse-submodules https://github.com/pingcap/tiflow.git tiflow
# - docker build -t dm -f Dockerfile ./tiflow

########### stage: Builder - cdc
########### stage: builder-cdc
FROM quay.io/rockylinux/rockylinux:8.10.20240528 as builder-cdc

# install packages.
RUN --mount=type=cache,target=/var/cache/dnf \
dnf upgrade-minimal -y && \
dnf install -y make git findutils

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

# install packages.
RUN dnf install -y make git

########### stage: Builder - dm
########### stage: builder-dm
FROM builder-cdc as builder-dm

# install nodejs toolchain
Expand All @@ -37,32 +39,30 @@ RUN mkdir -p $NVM_DIR && \
ENV PATH="${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN node --version && npm --version && npm install -g yarn

########### stage: Builder - total
########### stage: builder - total
FROM builder-dm as builder

########### stage: Buiding cdc
########### stage: building-cdc
FROM builder-cdc as building-cdc

COPY . /tiflow
COPY . /ws
ARG GOPROXY
RUN GOPROXY=${GOPROXY} make cdc -C /tiflow
RUN /tiflow/bin/cdc version
RUN GOPROXY=${GOPROXY} make cdc -C /ws
RUN /ws/bin/cdc version

########### stage: Buiding dm
########### stage: building-dm
FROM builder-dm as building-dm

COPY . /tiflow
COPY . /ws
ARG GOPROXY
RUN GOPROXY=${GOPROXY} make dm-master-with-webui dm-worker dmctl dm-syncer -C /tiflow
RUN /tiflow/bin/dm-master -V
RUN /tiflow/bin/dm-worker -V
RUN /tiflow/bin/dm-syncer -V
RUN /tiflow/bin/dmctl -V
RUN GOPROXY=${GOPROXY} make dm-master-with-webui dm-worker dmctl dm-syncer -C /ws
RUN /ws/bin/dm-master -V
RUN /ws/bin/dm-worker -V
RUN /ws/bin/dm-syncer -V
RUN /ws/bin/dmctl -V

########### stage: Final image - cdc
FROM ghcr.io/pingcap-qe/bases/tools-base:v1.9.1 as final-cdc
COPY --from=building-cdc /ws/bin/cdc /cdc

COPY --from=building-cdc /tiflow/bin/cdc /cdc
EXPOSE 8300
CMD ["/cdc"]

Expand All @@ -72,11 +72,10 @@ RUN /cdc version

########### stage: Final image - dm
FROM ghcr.io/pingcap-qe/bases/tools-base:v1.9.1 as final-dm

COPY --from=building-dm /tiflow/bin/dm-master /dm-master
COPY --from=building-dm /tiflow/bin/dm-worker /dm-worker
COPY --from=building-dm /tiflow/bin/dm-syncer /dm-syncer
COPY --from=building-dm /tiflow/bin/dmctl /dmctl
COPY --from=building-dm /ws/bin/dm-master /dm-master
COPY --from=building-dm /ws/bin/dm-worker /dm-worker
COPY --from=building-dm /ws/bin/dm-syncer /dm-syncer
COPY --from=building-dm /ws/bin/dmctl /dmctl

EXPOSE 8291 8261 8262

Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/cd/builders/tikv/fips.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN dnf install -y \
# renovate: datasource=github-release depName=protocolbuffers/protobuf
ARG PROTOBUF_VER=v3.15.8
RUN FILE=$([ "$(arch)" = "aarch64" ] && echo "protoc-${PROTOBUF_VER#?}-linux-aarch_64.zip" || echo "protoc-${PROTOBUF_VER#?}-linux-$(arch).zip"); \
curl -LO "https://github.com/protocolbuffers/protobuf/releases/download/${PROTOBUF_VER}/${FILE}" && unzip "$FILE" -d /usr/local/ && rm -f "$FILE"
curl -LO "https://github.com/protocolbuffers/protobuf/releases/download/${PROTOBUF_VER}/${FILE}" && unzip "$FILE" -d /usr/local/ && rm -f "$FILE"

# install rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y --default-toolchain none
Expand Down

0 comments on commit 33abf29

Please sign in to comment.