简介
貌似kustomize是没有arm版本的,我说的是32位的,所以那就自己编译一个吧
操作
首先clone仓库
git clone https://github.com/bboysoulcn/kustomize.git
之后看到了他的dockerfile
# build
FROM golang:alpine as builder
ARG VERSION
ARG COMMIT
ARG DATE
RUN mkdir /build
ADD . /build/
WORKDIR /build/kustomize
RUN CGO_ENABLED=0 GO111MODULE=on go build \
-ldflags="-s -X sigs.k8s.io/kustomize/api/provenance.version=${VERSION} \
-X sigs.k8s.io/kustomize/api/provenance.gitCommit=${COMMIT} \
-X sigs.k8s.io/kustomize/api/provenance.buildDate=${DATE}"
# only copy binary
FROM alpine
# install dependencies
RUN apk add --no-cache git openssh
COPY --from=builder /build/kustomize/kustomize /app/
WORKDIR /app
ENV PATH "$PATH:/app"
ENTRYPOINT ["/app/kustomize"]
也就是编译的话就是下面这个命令
CGO_ENABLED=0 GO111MODULE=on go build \
-ldflags="-s -X sigs.k8s.io/kustomize/api/provenance.version=${VERSION} \
-X sigs.k8s.io/kustomize/api/provenance.gitCommit=${COMMIT} \
-X sigs.k8s.io/kustomize/api/provenance.buildDate=${DATE}"
在此之前需要找到这三个变量${VERSION}
,${COMMIT}
,${DATE}
找了一下,在
releasing/cloudbuild_kustomize_image.yaml
下面有编译的脚本,主要是下面几行
args:
- -c
- >
docker
build
-t
gcr.io/$PROJECT_ID/kustomize:${_GIT_TAG}
-t
gcr.io/$PROJECT_ID/kustomize:latest
-f
kustomize.Dockerfile
--build-arg
VERSION=${_PULL_BASE_REF}
--build-arg
COMMIT=$(git rev-parse HEAD)
--build-arg
DATE=$(date -u +%FT%TZ)
.
所以
VERSION=${_PULL_BASE_REF}
COMMIT=$(git rev-parse HEAD)
DATE=$(date -u +%FT%TZ)
那么编译的命令就如下
CGO_ENABLED=0 GO111MODULE=on go build \
-ldflags="-s -X sigs.k8s.io/kustomize/api/provenance.version=v3.3.1 \
-X sigs.k8s.io/kustomize/api/provenance.gitCommit=91284782c4f11114362fcd94f6b0ad7eed2bfd8f \
-X sigs.k8s.io/kustomize/api/provenance.buildDate=2022-01-13T05:57:00Z"
树莓派上跑一个容器作为我们的编译环境
docker run -itd -v /data/trash/kustomize:/app golang:alpine sh
进入kustomize这个目录运行编译的命令就好了
欢迎关注我的博客www.bboy.app
Have Fun