Skip to content

Commit c668631

Browse files
committed
Don't use bash as the entrypoint for docker
The bash shell is not very good at playing init(1), let tini handle this instead by doing `docker run --init`. This makes it forward signals properly to e.g. make, and also reaps processes for long-running containers. However, we _need_ to override the entrypoint of the karalabe/xgo image, since it'll self-destruct otherwise. It (/build.sh) expects the command to be the import path and cannot handle getting the bash command line to run.
1 parent 3322c50 commit c668631

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: Makefile

+6-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ HYPERKIT_LDFLAGS := -X k8s.io/minikube/pkg/drivers/hyperkit.version=$(VERSION) -
114114

115115
# $(call DOCKER, image, command)
116116
define DOCKER
117-
docker run --rm -e GOCACHE=/app/.cache -e IN_DOCKER=1 --user $(shell id -u):$(shell id -g) -w /app -v $(PWD):/app -v $(GOPATH):/go --entrypoint /bin/bash $(1) -c '$(2)'
117+
docker run --rm -e GOCACHE=/app/.cache -e IN_DOCKER=1 --user $(shell id -u):$(shell id -g) -w /app -v $(PWD):/app -v $(GOPATH):/go --init $(1) /bin/bash -c '$(2)'
118118
endef
119119

120120
ifeq ($(BUILD_IN_DOCKER),y)
@@ -427,7 +427,10 @@ out/minikube-installer.exe: out/minikube-windows-amd64.exe
427427

428428
out/docker-machine-driver-hyperkit:
429429
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
430-
$(call DOCKER,$(HYPERKIT_BUILD_IMAGE),CC=o64-clang CXX=o64-clang++ /usr/bin/make $@)
430+
docker run --rm -e GOCACHE=/app/.cache -e IN_DOCKER=1 \
431+
--user $(shell id -u):$(shell id -g) -w /app \
432+
-v $(PWD):/app -v $(GOPATH):/go --init --entrypoint "" \
433+
$(HYPERKIT_BUILD_IMAGE) /bin/bash -c 'CC=o64-clang CXX=o64-clang++ /usr/bin/make $@'
431434
else
432435
GOOS=darwin CGO_ENABLED=1 go build \
433436
-ldflags="$(HYPERKIT_LDFLAGS)" \
@@ -436,7 +439,7 @@ endif
436439

437440
hyperkit_in_docker:
438441
rm -f out/docker-machine-driver-hyperkit
439-
$(call DOCKER,$(HYPERKIT_BUILD_IMAGE),CC=o64-clang CXX=o64-clang++ /usr/bin/make out/docker-machine-driver-hyperkit)
442+
$(MAKE) MINIKUBE_BUILD_IN_DOCKER=y out/docker-machine-driver-hyperkit
440443

441444
.PHONY: install-hyperkit-driver
442445
install-hyperkit-driver: out/docker-machine-driver-hyperkit

0 commit comments

Comments
 (0)