[build]: add build option to use native docker instead of dind for build (#2215)
using native docker is faster than dind dockerd with vfs storage driver https://github.com/Azure/sonic-buildimage/pull/2016 https://github.com/Azure/draft/issues/181 Signed-off-by: Wataru Ishida <ishida@nel-america.com>
This commit is contained in:
parent
5cff136951
commit
4db98b46e4
@ -70,6 +70,12 @@ DOCKER_RUN := docker run --rm=true --privileged \
|
|||||||
-e "https_proxy=$(https_proxy)" \
|
-e "https_proxy=$(https_proxy)" \
|
||||||
-i$(if $(TERM),t,)
|
-i$(if $(TERM),t,)
|
||||||
|
|
||||||
|
include rules/config
|
||||||
|
|
||||||
|
ifeq ($(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD), y)
|
||||||
|
DOCKER_RUN += -v /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
endif
|
||||||
|
|
||||||
DOCKER_BASE_BUILD = docker build --no-cache \
|
DOCKER_BASE_BUILD = docker build --no-cache \
|
||||||
-t $(SLAVE_BASE_IMAGE) \
|
-t $(SLAVE_BASE_IMAGE) \
|
||||||
--build-arg http_proxy=$(http_proxy) \
|
--build-arg http_proxy=$(http_proxy) \
|
||||||
|
@ -16,6 +16,10 @@ SONIC_CONFIG_BUILD_JOBS = 1
|
|||||||
# Corresponding -j argument will be passed to make/dpkg commands that build separate packages
|
# Corresponding -j argument will be passed to make/dpkg commands that build separate packages
|
||||||
SONIC_CONFIG_MAKE_JOBS = $(shell nproc)
|
SONIC_CONFIG_MAKE_JOBS = $(shell nproc)
|
||||||
|
|
||||||
|
# SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD - use native dockerd for build.
|
||||||
|
# If set to y SONiC build container will use native dockerd instead of dind for faster build
|
||||||
|
# SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD = y
|
||||||
|
|
||||||
# SONIC_CONFIG_ENABLE_COLORS - enable colored output in build system.
|
# SONIC_CONFIG_ENABLE_COLORS - enable colored output in build system.
|
||||||
# Comment next line to disable:
|
# Comment next line to disable:
|
||||||
# SONIC_CONFIG_ENABLE_COLORS = y
|
# SONIC_CONFIG_ENABLE_COLORS = y
|
||||||
|
2
slave.mk
2
slave.mk
@ -389,7 +389,7 @@ $(SONIC_INSTALL_WHEELS) : $(PYTHON_WHEELS_PATH)/%-install : .platform $$(addsuff
|
|||||||
docker-start :
|
docker-start :
|
||||||
@sudo sed -i '/http_proxy/d' /etc/default/docker
|
@sudo sed -i '/http_proxy/d' /etc/default/docker
|
||||||
@sudo bash -c "echo \"export http_proxy=$$http_proxy\" >> /etc/default/docker"
|
@sudo bash -c "echo \"export http_proxy=$$http_proxy\" >> /etc/default/docker"
|
||||||
@sudo service docker status &> /dev/null || ( sudo service docker start &> /dev/null && sleep 1 )
|
@test $(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) != "y" && sudo service docker status &> /dev/null || ( sudo service docker start &> /dev/null && sleep 1 )
|
||||||
|
|
||||||
# targets for building simple docker images that do not depend on any debian packages
|
# targets for building simple docker images that do not depend on any debian packages
|
||||||
$(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS)))
|
$(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start $$(addsuffix -load,$$(addprefix $(TARGET_PATH)/,$$($$*.gz_LOAD_DOCKERS)))
|
||||||
|
Loading…
Reference in New Issue
Block a user