@@ -71,15 +71,15 @@ else ifeq ($(shell go env GOHOSTOS), windows)
7171ENABLE_JOURNALD =0
7272endif
7373
74- # TODO(random-liu): Support different architectures.
75- # The debian-base:v2.0.0 image built from kubernetes repository is based on
76- # Debian Stretch. It includes systemd 241 with support for both +XZ and +LZ4
77- # compression. +LZ4 is needed on some os distros such as COS.
74+ # Set default base image to Debian 12 (Bookworm)
7875BASEIMAGE: =registry.k8s.io/build-image/debian-base:bookworm-v1.0.0
7976
8077# Disable cgo by default to make the binary statically linked.
8178CGO_ENABLED: =0
8279
80+ # Set default Go architecture to AMD64.
81+ GOARCH ?= amd64
82+
8383# Construct the "-tags" parameter used by "go build".
8484BUILD_TAGS? =
8585
@@ -185,7 +185,7 @@ output/linux_arm64/test/bin/%: $(PKG_SOURCES)
185185# In the future these targets should be deprecated.
186186./bin/log-counter : $(PKG_SOURCES )
187187ifeq ($(ENABLE_JOURNALD ) , 1)
188- CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GO111MODULE=on go build \
188+ CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=$(GOARCH) GO111MODULE=on go build \
189189 -mod vendor \
190190 -o bin/log-counter \
191191 -ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
196196endif
197197
198198./bin/node-problem-detector : $(PKG_SOURCES )
199- CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GO111MODULE=on go build \
199+ CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GOARCH= $( GOARCH ) GO111MODULE=on go build \
200200 -mod vendor \
201201 -o bin/node-problem-detector \
202202 -ldflags ' -X $(PKG)/pkg/version.version=$(VERSION)' \
@@ -205,13 +205,13 @@ endif
205205
206206./test/bin/problem-maker : $(PKG_SOURCES )
207207 cd test && \
208- CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GO111MODULE=on go build \
208+ CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GOARCH= $( GOARCH ) GO111MODULE=on go build \
209209 -o bin/problem-maker \
210210 -tags " $( LINUX_BUILD_TAGS) " \
211211 ./e2e/problemmaker/problem_maker.go
212212
213213./bin/health-checker : $(PKG_SOURCES )
214- CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GO111MODULE=on go build \
214+ CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GOARCH= $( GOARCH ) GO111MODULE=on go build \
215215 -mod vendor \
216216 -o bin/health-checker \
217217 -ldflags ' -X $(PKG)/pkg/version.version=$(VERSION)' \
@@ -242,8 +242,7 @@ $(NPD_NAME_VERSION)-%.tar.gz: $(ALL_BINARIES) test/e2e-install.sh
242242build-binaries : $(ALL_BINARIES )
243243
244244build-container : clean Dockerfile
245- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
246- docker buildx create --use
245+ docker buildx create --platform $(DOCKER_PLATFORMS ) --use
247246 docker buildx build --platform $(DOCKER_PLATFORMS ) -t $(IMAGE ) --build-arg BASEIMAGE=$(BASEIMAGE ) --build-arg LOGCOUNTER=$(LOGCOUNTER ) .
248247
249248$(TARBALL ) : ./bin/node-problem-detector ./bin/log-counter ./bin/health-checker ./test/bin/problem-maker
@@ -269,7 +268,6 @@ ifneq (,$(findstring gcr.io,$(REGISTRY)))
269268 gcloud auth configure-docker
270269endif
271270 # Build should be cached from build-container
272- docker buildx create --use
273271 docker buildx build --push --platform $(DOCKER_PLATFORMS) -t $(IMAGE) --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg LOGCOUNTER=$(LOGCOUNTER) .
274272
275273push-tar : build-tar
0 commit comments