Skip to content

Commit c0caf0c

Browse files
stepanblyschaklguohan
authored andcommitted
[dockers] Build stretch dockers only once and only in stretch slave docker (#2678)
Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
1 parent 145c134 commit c0caf0c

5 files changed

+15
-7
lines changed

platform/mellanox/docker-syncd-mlnx-rpc.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ $(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT)
66
$(DOCKER_SYNCD_MLNX_RPC)_PYTHON_DEBS += $(MLNX_SFPD)
77
$(DOCKER_SYNCD_MLNX_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_MLNX)
88
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC)
9+
SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_MLNX_RPC)
910
ifeq ($(ENABLE_SYNCD_RPC),y)
1011
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC)
11-
SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_MLNX_RPC)
1212
endif
1313

1414
$(DOCKER_SYNCD_MLNX_RPC)_CONTAINER_NAME = syncd

platform/mellanox/docker-syncd-mlnx.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ $(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API)
66
$(DOCKER_SYNCD_MLNX)_PYTHON_DEBS += $(MLNX_SFPD)
77
$(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)
88
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX)
9+
SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_MLNX)
910
ifneq ($(ENABLE_SYNCD_RPC),y)
1011
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX)
11-
SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_MLNX)
1212
endif
1313

1414
$(DOCKER_SYNCD_MLNX)_CONTAINER_NAME = syncd

rules/docker-base-stretch.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ STRACE = strace
1515
$(DOCKER_BASE_STRETCH)_DBG_PACKAGES += $(GDB) $(GDBSERVER) $(VIM) $(OPENSSH) $(SSHPASS) $(STRACE)
1616
endif
1717

18-
SONIC_DOCKER_IMAGES += $(DOCKER_BASE_STRETCH)
18+
SONIC_STRETCH_DOCKERS += $(DOCKER_BASE_STRETCH)

rules/docker-config-engine-stretch.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ $(DOCKER_CONFIG_ENGINE_STRETCH)_PATH = $(DOCKERS_PATH)/docker-config-engine-stre
55
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SWSSSDK_PY2)
66
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE)
77
$(DOCKER_CONFIG_ENGINE_STRETCH)_LOAD_DOCKERS += $(DOCKER_BASE_STRETCH)
8-
SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE_STRETCH)
8+
SONIC_STRETCH_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)

slave.mk

+11-3
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,16 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g
464464

465465
SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES))
466466

467+
# Build stretch docker images only in stretch slave docker,
468+
# jessie docker images only in jessie slave docker
469+
ifeq ($(BLDENV),stretch)
470+
DOCKER_IMAGES := $(SONIC_STRETCH_DOCKERS)
471+
else
472+
DOCKER_IMAGES := $(filter-out $(SONIC_STRETCH_DOCKERS), $(SONIC_DOCKER_IMAGES))
473+
endif
474+
467475
# Targets for building docker images
468-
$(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start \
476+
$(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start \
469477
$$(addprefix $(DEBS_PATH)/,$$($$*.gz_DEPENDS)) \
470478
$$(addprefix $(FILES_PATH)/,$$($$*.gz_FILES)) \
471479
$$(addprefix $(PYTHON_DEBS_PATH)/,$$($$*.gz_PYTHON_DEBS)) \
@@ -506,11 +514,11 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl
506514
if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt pop -a -f; popd; fi
507515
$(FOOTER)
508516

509-
SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES))
517+
SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES))
510518

511519
DOCKER_LOAD_TARGETS = $(addsuffix -load,$(addprefix $(TARGET_PATH)/, \
512520
$(SONIC_SIMPLE_DOCKER_IMAGES) \
513-
$(SONIC_DOCKER_IMAGES)))
521+
$(DOCKER_IMAGES)))
514522
$(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TARGET_PATH)/$$*.gz
515523
$(HEADER)
516524
docker load -i $(TARGET_PATH)/$*.gz $(LOG)

0 commit comments

Comments
 (0)