mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-12 12:48:51 +00:00
Use sudo only when not already root
This commit is contained in:
@@ -26,13 +26,15 @@ BASEIMAGE?=k8s.gcr.io/debian-base-$(ARCH):0.3.2
|
||||
# This option is for running docker manifest command
|
||||
export DOCKER_CLI_EXPERIMENTAL := enabled
|
||||
|
||||
SUDO=$(if $(filter 0,$(shell id -u)),,sudo)
|
||||
|
||||
build:
|
||||
cp ./* $(TEMP_DIR)
|
||||
cd $(TEMP_DIR) && sed -i "s|BASEIMAGE|$(BASEIMAGE)|g" Dockerfile
|
||||
|
||||
ifneq ($(ARCH),amd64)
|
||||
# Register /usr/bin/qemu-ARCH-static as the handler for non-x86 binaries in the kernel
|
||||
sudo ../../third_party/multiarch/qemu-user-static/register/register.sh --reset
|
||||
$(SUDO) ../../third_party/multiarch/qemu-user-static/register/register.sh --reset
|
||||
endif
|
||||
|
||||
docker build --pull -t $(IMAGE)-$(ARCH):$(TAG) $(TEMP_DIR)
|
||||
|
Reference in New Issue
Block a user