diff --git a/Dockerfile b/Dockerfile index 19590e1..fafd22e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ FROM golang:1.19 +ARG TARGETOS +ARG TARGETARCH ARG CODEGEN_VERSION="1.26.0" ARG CONTROLLER_GEN_VERSION="0.11.1" @@ -25,7 +27,7 @@ RUN wget http://github.com/kubernetes/code-generator/archive/kubernetes-${CODEGE wget https://github.com/kubernetes-sigs/controller-tools/archive/v${CONTROLLER_GEN_VERSION}.tar.gz && \ tar xvf ./v${CONTROLLER_GEN_VERSION}.tar.gz && \ cd ./controller-tools-${CONTROLLER_GEN_VERSION}/ && \ - go build -o controller-gen ./cmd/controller-gen/ && \ + GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o controller-gen ./cmd/controller-gen/ && \ mv ./controller-gen /usr/bin/ && \ rm -rf ../v${CONTROLLER_GEN_VERSION}.tar.gz && \ rm -rf ../controller-tools-${CONTROLLER_GEN_VERSION} @@ -46,4 +48,4 @@ USER codegen WORKDIR /usr/bin -CMD ["update-codegen.sh"] \ No newline at end of file +CMD ["update-codegen.sh"] diff --git a/Makefile b/Makefile index a8b0a8c..e760841 100644 --- a/Makefile +++ b/Makefile @@ -6,4 +6,4 @@ default: build .PHONY: build build: - docker build -t $(IMAGE) . + docker buildx build --platform linux/amd64,linux/arm64 -t $(IMAGE) .