[build]: add user define mount for the build (#5089)

following command add additional mount in the sonic:

    DOCKER_BUILDER_USER_MOUNT=/data2:/data2,/data:/data make sonic-slave-bash

Signed-off-by: Guohan Lu <lguohan@gmail.com>
This commit is contained in:
lguohan 2020-08-01 21:59:06 -07:00 committed by GitHub
parent 918ce2a633
commit a9dc409d61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,6 +46,8 @@ SHELL = /bin/bash
USER := $(shell id -un)
PWD := $(shell pwd)
comma := ,
ifeq ($(USER), root)
$(error Add your user account to docker group and use your user account to make. root or sudo are not supported!)
endif
@ -117,6 +119,10 @@ DOCKER_RUN := docker run --rm=true --privileged --init \
include rules/config
ifneq ($(DOCKER_BUILDER_USER_MOUNT),)
DOCKER_RUN += $(foreach mount,$(subst $(comma), ,$(DOCKER_BUILDER_USER_MOUNT)), $(addprefix -v , $(mount)))
endif
ifneq ($(SONIC_DPKG_CACHE_SOURCE),)
DOCKER_RUN += -v "$(SONIC_DPKG_CACHE_SOURCE):/dpkg_cache:rw"
endif