1414
1515# Build the node-problem-detector image.
1616
17- .PHONY : all build-container build-tar build push-container push-tar push clean vet fmt version Dockerfile
17+ .PHONY : all build-container build-tar build push-container push-tar push clean vet fmt version \
18+ Dockerfile build-binaries docker-builder build-in-docker
1819
1920all : build
2021
@@ -46,7 +47,6 @@ IMAGE:=$(REGISTRY)/node-problem-detector:$(TAG)
4647
4748# ENABLE_JOURNALD enables build journald support or not. Building journald support needs libsystemd-dev
4849# or libsystemd-journal-dev.
49- # TODO(random-liu): Build NPD inside container.
5050ENABLE_JOURNALD? =1
5151
5252# TODO(random-liu): Support different architectures.
@@ -93,7 +93,9 @@ Dockerfile: Dockerfile.in
9393test : vet fmt
9494 go test -timeout=1m -v -race ./cmd/options ./pkg/... $(BUILD_TAGS )
9595
96- build-container : ./bin/node-problem-detector ./bin/log-counter Dockerfile
96+ build-binaries : ./bin/node-problem-detector ./bin/log-counter
97+
98+ build-container : build-binaries Dockerfile
9799 docker build -t $(IMAGE ) .
98100
99101build-tar : ./bin/node-problem-detector ./bin/log-counter
@@ -103,6 +105,12 @@ build-tar: ./bin/node-problem-detector ./bin/log-counter
103105
104106build : build-container build-tar
105107
108+ docker-builder :
109+ docker build -t npd-builder ./builder
110+
111+ build-in-docker : clean docker-builder
112+ docker run -v ` pwd` :/gopath/src/k8s.io/node-problem-detector/ npd-builder:latest bash -c ' cd /gopath/src/k8s.io/node-problem-detector/ && make build-binaries'
113+
106114push-container : build-container
107115 gcloud docker -- push $(IMAGE )
108116
0 commit comments