@@ -71,15 +71,15 @@ else ifeq ($(shell go env GOHOSTOS), windows)
71
71
ENABLE_JOURNALD =0
72
72
endif
73
73
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)
78
75
BASEIMAGE: =registry.k8s.io/build-image/debian-base:bookworm-v1.0.0
79
76
80
77
# Disable cgo by default to make the binary statically linked.
81
78
CGO_ENABLED: =0
82
79
80
+ # Set default Go architecture to AMD64.
81
+ GOARCH ?= amd64
82
+
83
83
# Construct the "-tags" parameter used by "go build".
84
84
BUILD_TAGS? =
85
85
@@ -185,7 +185,7 @@ output/linux_arm64/test/bin/%: $(PKG_SOURCES)
185
185
# In the future these targets should be deprecated.
186
186
./bin/log-counter : $(PKG_SOURCES )
187
187
ifeq ($(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 \
189
189
-mod vendor \
190
190
-o bin/log-counter \
191
191
-ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
196
196
endif
197
197
198
198
./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 \
200
200
-mod vendor \
201
201
-o bin/node-problem-detector \
202
202
-ldflags ' -X $(PKG)/pkg/version.version=$(VERSION)' \
@@ -205,13 +205,13 @@ endif
205
205
206
206
./test/bin/problem-maker : $(PKG_SOURCES )
207
207
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 \
209
209
-o bin/problem-maker \
210
210
-tags " $( LINUX_BUILD_TAGS) " \
211
211
./e2e/problemmaker/problem_maker.go
212
212
213
213
./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 \
215
215
-mod vendor \
216
216
-o bin/health-checker \
217
217
-ldflags ' -X $(PKG)/pkg/version.version=$(VERSION)' \
@@ -242,8 +242,7 @@ $(NPD_NAME_VERSION)-%.tar.gz: $(ALL_BINARIES) test/e2e-install.sh
242
242
build-binaries : $(ALL_BINARIES )
243
243
244
244
build-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
247
246
docker buildx build --platform $(DOCKER_PLATFORMS ) -t $(IMAGE ) --build-arg BASEIMAGE=$(BASEIMAGE ) --build-arg LOGCOUNTER=$(LOGCOUNTER ) .
248
247
249
248
$(TARBALL ) : ./bin/node-problem-detector ./bin/log-counter ./bin/health-checker ./test/bin/problem-maker
@@ -269,7 +268,6 @@ ifneq (,$(findstring gcr.io,$(REGISTRY)))
269
268
gcloud auth configure-docker
270
269
endif
271
270
# Build should be cached from build-container
272
- docker buildx create --use
273
271
docker buildx build --push --platform $(DOCKER_PLATFORMS) -t $(IMAGE) --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg LOGCOUNTER=$(LOGCOUNTER) .
274
272
275
273
push-tar : build-tar
0 commit comments