Skip to content
Snippets Groups Projects
Unverified Commit c6032474 authored by Gaëtan Harter's avatar Gaëtan Harter
Browse files

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.
parent 357a4a0d
No related branches found
No related tags found
No related merge requests found
...@@ -83,6 +83,12 @@ DOCKER_OVERRIDE_CMDLINE := $(strip $(DOCKER_OVERRIDE_CMDLINE)) ...@@ -83,6 +83,12 @@ DOCKER_OVERRIDE_CMDLINE := $(strip $(DOCKER_OVERRIDE_CMDLINE))
# Overwrite if you want to use `docker` with sudo # Overwrite if you want to use `docker` with sudo
DOCKER ?= docker 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. # This will execute `make $(DOCKER_MAKECMDGOALS)` inside a Docker container.
# We do not push the regular $(MAKECMDGOALS) to the container's make command in # 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 # order to only perform building inside the container and defer executing any
...@@ -105,6 +111,7 @@ DOCKER ?= docker ...@@ -105,6 +111,7 @@ DOCKER ?= docker
-e 'RIOTBOARD=$(DOCKER_BUILD_ROOT)/riotboard' \ -e 'RIOTBOARD=$(DOCKER_BUILD_ROOT)/riotboard' \
-e 'RIOTMAKE=$(DOCKER_BUILD_ROOT)/riotmake' \ -e 'RIOTMAKE=$(DOCKER_BUILD_ROOT)/riotmake' \
-e 'RIOTPROJECT=$(DOCKER_BUILD_ROOT)/riotproject' \ -e 'RIOTPROJECT=$(DOCKER_BUILD_ROOT)/riotproject' \
$(DOCKER_VOLUMES_AND_ENV) \
$(DOCKER_ENVIRONMENT_CMDLINE) \ $(DOCKER_ENVIRONMENT_CMDLINE) \
-w '$(DOCKER_BUILD_ROOT)/riotproject/$(BUILDRELPATH)' \ -w '$(DOCKER_BUILD_ROOT)/riotproject/$(BUILDRELPATH)' \
'$(DOCKER_IMAGE)' make $(DOCKER_MAKECMDGOALS) $(DOCKER_OVERRIDE_CMDLINE) '$(DOCKER_IMAGE)' make $(DOCKER_MAKECMDGOALS) $(DOCKER_OVERRIDE_CMDLINE)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment