makefiles/docker.inc.mk: allow overwriting 'docker' command
Not all users register their user in the docker group and should not run the whole make process as root to use docker. They can now overwrite DOCKER with `DOCKER="sudo docker"`. Creating files as a user is correctly handled as `id -u` is still run as the original user.
This commit is contained in:
parent
b4feb4dc85
commit
e5c49aa486
@ -79,6 +79,9 @@ DOCKER_OVERRIDE_CMDLINE := $(foreach varname,$(DOCKER_ENV_VARS), \
|
||||
))
|
||||
DOCKER_OVERRIDE_CMDLINE := $(strip $(DOCKER_OVERRIDE_CMDLINE))
|
||||
|
||||
# Overwrite if you want to use `docker` with sudo
|
||||
DOCKER ?= docker
|
||||
|
||||
# This will execute `make $(DOCKER_MAKECMDGOALS)` inside a Docker container.
|
||||
# We do not push the regular $(MAKECMDGOALS) to the container's make command in
|
||||
# order to only perform building inside the container and defer executing any
|
||||
@ -88,7 +91,7 @@ DOCKER_OVERRIDE_CMDLINE := $(strip $(DOCKER_OVERRIDE_CMDLINE))
|
||||
# hardware which may not be reachable from inside the container.
|
||||
..in-docker-container:
|
||||
@$(COLOR_ECHO) '$(COLOR_GREEN)Launching build container using image "$(DOCKER_IMAGE)".$(COLOR_RESET)'
|
||||
docker run $(DOCKER_FLAGS) -t -u "$$(id -u)" \
|
||||
$(DOCKER) run $(DOCKER_FLAGS) -t -u "$$(id -u)" \
|
||||
-v '$(RIOTBASE):$(DOCKER_BUILD_ROOT)/riotbase' \
|
||||
-v '$(RIOTCPU):$(DOCKER_BUILD_ROOT)/riotcpu' \
|
||||
-v '$(RIOTBOARD):$(DOCKER_BUILD_ROOT)/riotboard' \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user