mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
makefiles/docker.inc.mk: use 'docker_volume' function
Use 'docker_volume' function for mounting. When mounting 'localtime' this will only use the 'ro' option and ignore 'DOCKER_VOLUME_OPTIONS'.
This commit is contained in:
parent
e5032a611b
commit
49a78bad0d
@ -209,7 +209,7 @@ define _docker_volume_and_env
|
||||
$(call docker_environ_mapping,$1,$2,$3)
|
||||
endef
|
||||
docker_volumes_mapping = $(foreach d,$1,$(call _docker_volume_mapping,$d,$2,$3))
|
||||
_docker_volume_mapping = $(if $1,$(if $(call dir_is_outside_riotbase,$1),-v '$(abspath $1):$(call path_in_docker,$1,$2,$3)'))
|
||||
_docker_volume_mapping = $(if $1,$(if $(call dir_is_outside_riotbase,$1),$(call docker_volume,$(abspath $1),$(call path_in_docker,$1,$2,$3))))
|
||||
docker_environ_mapping = $(addprefix -e ,$(call docker_cmdline_mapping,$1,$2,$3))
|
||||
docker_cmdline_mapping = $(if $($1),'$1=$(call path_in_docker,$($1),$2,$3)')
|
||||
|
||||
@ -220,8 +220,8 @@ DOCKER_APPDIR = $(DOCKER_RIOTPROJECT)/$(BUILDRELPATH)
|
||||
|
||||
|
||||
# Directory mapping in docker and directories environment variable configuration
|
||||
DOCKER_VOLUMES_AND_ENV += -v '$(ETC_LOCALTIME):/etc/localtime:ro'
|
||||
DOCKER_VOLUMES_AND_ENV += -v '$(RIOTBASE):$(DOCKER_RIOTBASE)'
|
||||
DOCKER_VOLUMES_AND_ENV += $(call docker_volume,$(ETC_LOCALTIME),/etc/localtime,ro)
|
||||
DOCKER_VOLUMES_AND_ENV += $(call docker_volume,$(RIOTBASE),$(DOCKER_RIOTBASE))
|
||||
DOCKER_VOLUMES_AND_ENV += -e 'RIOTBASE=$(DOCKER_RIOTBASE)'
|
||||
DOCKER_VOLUMES_AND_ENV += -e 'CCACHE_BASEDIR=$(DOCKER_RIOTBASE)'
|
||||
|
||||
@ -233,7 +233,7 @@ DOCKER_VOLUMES_AND_ENV += $(call docker_volume_and_env,RIOTBOARD,,riotboard)
|
||||
DOCKER_VOLUMES_AND_ENV += $(call docker_volume_and_env,RIOTMAKE,,riotmake)
|
||||
|
||||
# Add GIT_CACHE_DIR if the directory exists
|
||||
DOCKER_VOLUMES_AND_ENV += $(if $(wildcard $(GIT_CACHE_DIR)),-v '$(GIT_CACHE_DIR):$(DOCKER_BUILD_ROOT)/gitcache')
|
||||
DOCKER_VOLUMES_AND_ENV += $(if $(wildcard $(GIT_CACHE_DIR)),$(call docker_volume,$(GIT_CACHE_DIR),$(DOCKER_BUILD_ROOT)/gitcache))
|
||||
DOCKER_VOLUMES_AND_ENV += $(if $(wildcard $(GIT_CACHE_DIR)),-e 'GIT_CACHE_DIR=$(DOCKER_BUILD_ROOT)/gitcache')
|
||||
|
||||
# Remap external module directories.
|
||||
@ -266,7 +266,7 @@ endif
|
||||
# Handle worktree by mounting the git common dir in the same location
|
||||
_is_git_worktree = $(shell grep '^gitdir: ' $(RIOTBASE)/.git 2>/dev/null)
|
||||
GIT_WORKTREE_COMMONDIR = $(abspath $(shell git rev-parse --git-common-dir))
|
||||
DOCKER_VOLUMES_AND_ENV += $(if $(_is_git_worktree),-v '$(GIT_WORKTREE_COMMONDIR):$(GIT_WORKTREE_COMMONDIR)')
|
||||
DOCKER_VOLUMES_AND_ENV += $(if $(_is_git_worktree),$(call docker_volume,$(GIT_WORKTREE_COMMONDIR),$(GIT_WORKTREE_COMMONDIR)))
|
||||
|
||||
# This will execute `make $(DOCKER_MAKECMDGOALS)` inside a Docker container.
|
||||
# We do not push the regular $(MAKECMDGOALS) to the container's make command in
|
||||
|
Loading…
Reference in New Issue
Block a user