From c6686317d0f0270630805f4f0f4c75005368cf80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sat, 2 Nov 2019 15:26:46 +0100 Subject: [PATCH] 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. --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 94683311887b..a7ff0eced78e 100755 --- a/Makefile +++ b/Makefile @@ -114,7 +114,7 @@ HYPERKIT_LDFLAGS := -X k8s.io/minikube/pkg/drivers/hyperkit.version=$(VERSION) - # $(call DOCKER, image, command) define DOCKER - 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)' + 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)' endef ifeq ($(BUILD_IN_DOCKER),y) @@ -427,7 +427,10 @@ out/minikube-installer.exe: out/minikube-windows-amd64.exe out/docker-machine-driver-hyperkit: ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y) - $(call DOCKER,$(HYPERKIT_BUILD_IMAGE),CC=o64-clang CXX=o64-clang++ /usr/bin/make $@) + 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 --entrypoint "" \ + $(HYPERKIT_BUILD_IMAGE) /bin/bash -c 'CC=o64-clang CXX=o64-clang++ /usr/bin/make $@' else GOOS=darwin CGO_ENABLED=1 go build \ -ldflags="$(HYPERKIT_LDFLAGS)" \ @@ -436,7 +439,7 @@ endif hyperkit_in_docker: rm -f out/docker-machine-driver-hyperkit - $(call DOCKER,$(HYPERKIT_BUILD_IMAGE),CC=o64-clang CXX=o64-clang++ /usr/bin/make out/docker-machine-driver-hyperkit) + $(MAKE) MINIKUBE_BUILD_IN_DOCKER=y out/docker-machine-driver-hyperkit .PHONY: install-hyperkit-driver install-hyperkit-driver: out/docker-machine-driver-hyperkit