-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dockerfiles/cd/builders): add builder image for tidb-operator (#338
) Signed-off-by: wuhuizuo <[email protected]> --------- Signed-off-by: wuhuizuo <[email protected]>
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 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 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,31 @@ | ||
# build requires: | ||
# - docker >= v20.10 | ||
# | ||
# build steps: | ||
# - git clone https://github.com/pingcap/tidb-operator.git tidb | ||
# - rm tidb-operator/.dockerignore # make step depended on git metadata. | ||
# - docker build -t tidb-operator -f Dockerfile ./tidb-operator | ||
|
||
########### stage: Builder | ||
ARG GOLANG_VERSION=1.21.12 | ||
FROM golang:${GOLANG_VERSION} as builder | ||
|
||
# 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 | ||
FROM builder as building | ||
COPY . /ws | ||
ARG GOPROXY | ||
RUN GOPROXY=${GOPROXY} make build -C /ws && mv /ws/images/tidb-operator/bin/$(arch) /ws/bin | ||
|
||
########### stage: Final image | ||
FROM ghcr.io/pingcap-qe/bases/tidb-base:v1.9.0 | ||
|
||
COPY --from=building /ws/bin/tidb-scheduler /usr/local/bin/tidb-scheduler | ||
COPY --from=building /ws/bin/tidb-discovery /usr/local/bin/tidb-discovery | ||
COPY --from=building /ws/bin/tidb-controller-manager /usr/local/bin/tidb-controller-manager | ||
COPY --from=building /ws/bin/tidb-admission-webhook /usr/local/bin/tidb-admission-webhook |