Skip to content

Commit

Permalink
[dockers] Build stretch dockers only once and only in stretch slave d…
Browse files Browse the repository at this point in the history
…ocker (#2678)

Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
  • Loading branch information
stepanblyschak authored and lguohan committed Mar 19, 2019
1 parent 145c134 commit c0caf0c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion platform/mellanox/docker-syncd-mlnx-rpc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ $(DOCKER_SYNCD_MLNX_RPC)_DEPENDS += $(SYNCD_RPC) $(LIBTHRIFT)
$(DOCKER_SYNCD_MLNX_RPC)_PYTHON_DEBS += $(MLNX_SFPD)
$(DOCKER_SYNCD_MLNX_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_MLNX)
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC)
SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_MLNX_RPC)
ifeq ($(ENABLE_SYNCD_RPC),y)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX_RPC)
SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_MLNX_RPC)
endif

$(DOCKER_SYNCD_MLNX_RPC)_CONTAINER_NAME = syncd
Expand Down
2 changes: 1 addition & 1 deletion platform/mellanox/docker-syncd-mlnx.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ $(DOCKER_SYNCD_MLNX)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API)
$(DOCKER_SYNCD_MLNX)_PYTHON_DEBS += $(MLNX_SFPD)
$(DOCKER_SYNCD_MLNX)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX)
SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_MLNX)
ifneq ($(ENABLE_SYNCD_RPC),y)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MLNX)
SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_MLNX)
endif

$(DOCKER_SYNCD_MLNX)_CONTAINER_NAME = syncd
Expand Down
2 changes: 1 addition & 1 deletion rules/docker-base-stretch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ STRACE = strace
$(DOCKER_BASE_STRETCH)_DBG_PACKAGES += $(GDB) $(GDBSERVER) $(VIM) $(OPENSSH) $(SSHPASS) $(STRACE)
endif

SONIC_DOCKER_IMAGES += $(DOCKER_BASE_STRETCH)
SONIC_STRETCH_DOCKERS += $(DOCKER_BASE_STRETCH)
2 changes: 1 addition & 1 deletion rules/docker-config-engine-stretch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ $(DOCKER_CONFIG_ENGINE_STRETCH)_PATH = $(DOCKERS_PATH)/docker-config-engine-stre
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SWSSSDK_PY2)
$(DOCKER_CONFIG_ENGINE_STRETCH)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE)
$(DOCKER_CONFIG_ENGINE_STRETCH)_LOAD_DOCKERS += $(DOCKER_BASE_STRETCH)
SONIC_DOCKER_IMAGES += $(DOCKER_CONFIG_ENGINE_STRETCH)
SONIC_STRETCH_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)
14 changes: 11 additions & 3 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,16 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_SIMPLE_DOCKER_IMAGES)) : $(TARGET_PATH)/%.g

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

# Build stretch docker images only in stretch slave docker,
# jessie docker images only in jessie slave docker
ifeq ($(BLDENV),stretch)
DOCKER_IMAGES := $(SONIC_STRETCH_DOCKERS)
else
DOCKER_IMAGES := $(filter-out $(SONIC_STRETCH_DOCKERS), $(SONIC_DOCKER_IMAGES))
endif

# Targets for building docker images
$(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start \
$(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform docker-start \
$$(addprefix $(DEBS_PATH)/,$$($$*.gz_DEPENDS)) \
$$(addprefix $(FILES_PATH)/,$$($$*.gz_FILES)) \
$$(addprefix $(PYTHON_DEBS_PATH)/,$$($$*.gz_PYTHON_DEBS)) \
Expand Down Expand Up @@ -506,11 +514,11 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl
if [ -f $($*.gz_PATH).patch/series ]; then pushd $($*.gz_PATH) && quilt pop -a -f; popd; fi
$(FOOTER)

SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES))
SONIC_TARGET_LIST += $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES))

DOCKER_LOAD_TARGETS = $(addsuffix -load,$(addprefix $(TARGET_PATH)/, \
$(SONIC_SIMPLE_DOCKER_IMAGES) \
$(SONIC_DOCKER_IMAGES)))
$(DOCKER_IMAGES)))
$(DOCKER_LOAD_TARGETS) : $(TARGET_PATH)/%.gz-load : .platform docker-start $$(TARGET_PATH)/$$*.gz
$(HEADER)
docker load -i $(TARGET_PATH)/$*.gz $(LOG)
Expand Down

0 comments on commit c0caf0c

Please sign in to comment.