1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:12:57 +01:00

docker: Use system GIT_CACHE_DIR if available

If GIT_CACHE_DIR is a directory make it available to docker.
This will allow using the system git_cache also in the docker container.
This commit is contained in:
Gaëtan Harter 2018-07-31 15:02:30 +02:00
parent 357a4a0db9
commit c60324744c
No known key found for this signature in database
GPG Key ID: 76DF6BCF1B1F883B

View File

@ -83,6 +83,12 @@ DOCKER_OVERRIDE_CMDLINE := $(strip $(DOCKER_OVERRIDE_CMDLINE))
# Overwrite if you want to use `docker` with sudo
DOCKER ?= docker
# Mounted volumes and exported environment variables
# 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)),-e GIT_CACHE_DIR=$(DOCKER_BUILD_ROOT)/gitcache)
# 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
@ -105,6 +111,7 @@ DOCKER ?= docker
-e 'RIOTBOARD=$(DOCKER_BUILD_ROOT)/riotboard' \
-e 'RIOTMAKE=$(DOCKER_BUILD_ROOT)/riotmake' \
-e 'RIOTPROJECT=$(DOCKER_BUILD_ROOT)/riotproject' \
$(DOCKER_VOLUMES_AND_ENV) \
$(DOCKER_ENVIRONMENT_CMDLINE) \
-w '$(DOCKER_BUILD_ROOT)/riotproject/$(BUILDRELPATH)' \
'$(DOCKER_IMAGE)' make $(DOCKER_MAKECMDGOALS) $(DOCKER_OVERRIDE_CMDLINE)