diff --git a/Makefile.work b/Makefile.work index 975b9a5dcd2..2cb6eae1258 100644 --- a/Makefile.work +++ b/Makefile.work @@ -117,6 +117,7 @@ SONIC_BUILD_INSTRUCTION := make \ PASSWORD=$(PASSWORD) \ USERNAME=$(USERNAME) \ SONIC_BUILD_JOBS=$(SONIC_BUILD_JOBS) \ + SONIC_USE_DOCKER_BUILDKIT=$(SONIC_USE_DOCKER_BUILDKIT) \ VS_PREPARE_MEM=$(VS_PREPARE_MEM) \ KERNEL_PROCURE_METHOD=$(KERNEL_PROCURE_METHOD) \ HTTP_PROXY=$(http_proxy) \ diff --git a/rules/config b/rules/config index c5213bddd40..31e5d40ff1f 100644 --- a/rules/config +++ b/rules/config @@ -16,6 +16,14 @@ SONIC_CONFIG_BUILD_JOBS = 1 # Corresponding -j argument will be passed to make/dpkg commands that build separate packages SONIC_CONFIG_MAKE_JOBS = $(shell nproc) +# SONIC_USE_DOCKER_BUILDKIT - use docker buildkit for build. +# If set to y SONiC build system will set environment variable DOCKER_BUILDKIT=1 +# to enable docker buildkit. +# This options will speed up docker image build time. +# NOTE: SONIC_USE_DOCKER_BUILDKIT will produce larger installable SONiC image +# because of a docker bug (more details: https://github.com/moby/moby/issues/38903) +# SONIC_USE_DOCKER_BUILDKIT = y + # 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 diff --git a/slave.mk b/slave.mk index 6cedda61202..d09f4cbb612 100644 --- a/slave.mk +++ b/slave.mk @@ -151,6 +151,7 @@ $(info "CONFIGURED_PLATFORM" : "$(if $(PLATFORM),$(PLATFORM),$(CONFI $(info "SONIC_CONFIG_PRINT_DEPENDENCIES" : "$(SONIC_CONFIG_PRINT_DEPENDENCIES)") $(info "SONIC_BUILD_JOBS" : "$(SONIC_BUILD_JOBS)") $(info "SONIC_CONFIG_MAKE_JOBS" : "$(SONIC_CONFIG_MAKE_JOBS)") +$(info "SONIC_USE_DOCKER_BUILDKIT" : "$(SONIC_USE_DOCKER_BUILDKIT)") $(info "USERNAME" : "$(USERNAME)") $(info "PASSWORD" : "$(PASSWORD)") $(info "ENABLE_DHCP_GRAPH_SERVICE" : "$(ENABLE_DHCP_GRAPH_SERVICE)") @@ -175,6 +176,12 @@ $(info "BLDENV" : "$(BLDENV)") $(info "VS_PREPARE_MEM" : "$(VS_PREPARE_MEM)") $(info ) +ifeq ($(SONIC_USE_DOCKER_BUILDKIT),y) +$(warning "Using SONIC_USE_DOCKER_BUILDKIT will produce larger installable SONiC image because of a docker bug (more details: https://github.com/moby/moby/issues/38903)") +export DOCKER_BUILDKIT=1 +endif + + ############################################################################### ## Generic rules section ## All rules must go after includes for propper targets expansion diff --git a/sonic-slave-stretch/Dockerfile b/sonic-slave-stretch/Dockerfile index 9d94d11197e..915f0ac6817 100644 --- a/sonic-slave-stretch/Dockerfile +++ b/sonic-slave-stretch/Dockerfile @@ -326,5 +326,5 @@ RUN add-apt-repository \ $(lsb_release -cs) \ stable" RUN apt-get update -RUN apt-get install -y docker-ce=17.03.2~ce-0~debian-stretch +RUN apt-get install -y docker-ce=5:18.09.5~3-0~debian-stretch RUN echo "DOCKER_OPTS=\"--experimental --storage-driver=vfs\"" >> /etc/default/docker