-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(dockerfiles/cd): refactor multi stages building dockerfiles …
…for tiflow (#118) - include components: ticdc, dm - also fix build step for pd image Signed-off-by: wuhuizuo <[email protected]> --------- Signed-off-by: wuhuizuo <[email protected]>
- Loading branch information
Showing
6 changed files
with
101 additions
and
96 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,80 @@ | ||
# build requires: | ||
# - docker >= v20.10 | ||
# | ||
# build steps: | ||
# - git clone --recurse-submodules https://github.com/pingcap/tiflow.git tiflow | ||
# - docker build -t dm -f Dockerfile ./tiflow | ||
|
||
########### stage: Builder - cdc | ||
FROM centos:7.9.2009 as builder-cdc | ||
|
||
# install packages. | ||
RUN yum update --nogpgcheck -y && \ | ||
yum install --nogpgcheck -y epel-release centos-release-scl deltarpm && \ | ||
yum update --nogpgcheck -y && \ | ||
yum groupinstall --nogpgcheck -y "Development Tools" && \ | ||
yum clean all | ||
|
||
# install golang toolchain | ||
# renovate: datasource=docker depName=golang | ||
ARG GOLANG_VERSION=1.21.4 | ||
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: Builder - dm | ||
FROM builder-cdc as builder-dm | ||
|
||
# install nodejs toolchain | ||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash && \ | ||
source ~/.bashrc && \ | ||
nvm install 16 && \ | ||
npm install -g yarn | ||
|
||
########### stage: Builder - total | ||
FROM builder-dm as builder | ||
|
||
########### stage: Buiding cdc | ||
FROM builder-cdc as building-cdc | ||
|
||
COPY . /tiflow | ||
ARG GOPROXY | ||
RUN GOPROXY=${GOPROXY} make cdc -C /tiflow | ||
RUN /tiflow/bin/cdc version | ||
|
||
########### stage: Buiding dm | ||
FROM builder-dm as building-dm | ||
|
||
COPY . /tiflow | ||
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 | ||
|
||
########### stage: Final image - cdc | ||
FROM ghcr.io/pingcap-qe/bases/tools-base:v1.7.1 as final-cdc | ||
|
||
COPY --from=building-cdc /tiflow/bin/cdc /cdc | ||
EXPOSE 8300 | ||
CMD ["/cdc"] | ||
|
||
COPY . /tiflow | ||
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 | ||
|
||
########### stage: Final image - dm | ||
FROM ghcr.io/pingcap-qe/bases/tools-base:v1.7.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 | ||
|
||
EXPOSE 8291 8261 8262 |
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
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