summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tools/bazel.mk5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/bazel.mk b/tools/bazel.mk
index 45fbbecca..71641970d 100644
--- a/tools/bazel.mk
+++ b/tools/bazel.mk
@@ -21,7 +21,7 @@ BRANCH_NAME := $(shell (git branch --show-current 2>/dev/null || \
# Bazel container configuration (see below).
USER ?= gvisor
-DOCKER_NAME ?= gvisor-bazel
+DOCKER_NAME ?= gvisor-bazel-$(shell readlink -m $(CURDIR) | md5sum | cut -c1-8)
DOCKER_RUN_OPTIONS ?= --privileged
BAZEL_CACHE := $(shell readlink -m ~/.cache/bazel/)
GCLOUD_CONFIG := $(shell readlink -m ~/.config/gcloud/)
@@ -50,6 +50,7 @@ FULL_DOCKER_RUN_OPTIONS += -v "$(DOCKER_SOCKET):$(DOCKER_SOCKET)"
##
bazel-server-start: load-default ## Starts the bazel server.
docker run -d --rm \
+ --init \
--name $(DOCKER_NAME) \
--user 0:0 \
-v "$(CURDIR):$(CURDIR)" \
@@ -61,7 +62,7 @@ bazel-server-start: load-default ## Starts the bazel server.
sh -c "groupadd --gid $(GID) --non-unique $(USER) && \
useradd --uid $(UID) --non-unique --no-create-home --gid $(GID) -d $(HOME) $(USER) && \
bazel version && \
- while :; do sleep 3600; done"
+ exec tail --pid=\$$(bazel info server_pid) -f /dev/null"
@while :; do if docker logs $(DOCKER_NAME) 2>/dev/null | grep "Build label:" >/dev/null; then break; fi; sleep 1; done
.PHONY: bazel-server-start