[build]: add arch name in sonic-slave docker image

for exmaple, for arm64, the sonic-slave docker image name
is sonic-slave-arm64-$(USER)

for amd64, the docker image is kept as it is

Signed-off-by: Guohan Lu <lguohan@gmail.com>
This commit is contained in:
Guohan Lu 2020-12-25 02:21:57 -08:00
parent 2999dfa57c
commit 512eb6bee2
6 changed files with 22 additions and 4 deletions

1
.gitignore vendored
View File

@ -23,6 +23,7 @@ target/
# Autogenerated Dockerfiles
sonic-slave*/Dockerfile
sonic-slave*/Dockerfile.user
dockers/*/Dockerfile
platform/*/docker-*/Dockerfile

View File

@ -72,9 +72,9 @@ SONIC_COMMON_FLAGS_LIST := $(CONFIGURED_PLATFORM) \
$(SONIC_PROFILING_ON) $(SONIC_ENABLE_SYNCD_RPC)
SONIC_COMMON_DPKG_LIST := debian/control debian/changelog debian/rules \
debian/compat debian/install debian/copyright
SONIC_COMMON_BASE_FILES_LIST := sonic-slave-jessie/Dockerfile.j2 sonic-slave-jessie/Dockerfile.user \
sonic-slave-stretch/Dockerfile.j2 sonic-slave-stretch/Dockerfile.user \
sonic-slave-buster/Dockerfile.j2 sonic-slave-buster/Dockerfile.user
SONIC_COMMON_BASE_FILES_LIST := sonic-slave-jessie/Dockerfile.j2 sonic-slave-jessie/Dockerfile.user.j2 \
sonic-slave-stretch/Dockerfile.j2 sonic-slave-stretch/Dockerfile.user.j2 \
sonic-slave-buster/Dockerfile.j2 sonic-slave-buster/Dockerfile.user.j2
@ -181,7 +181,7 @@ define GET_MOD_DEP_SHA
$($(dfile)_DEP_FLAGS_FILE) $($(dfile)_MOD_HASH_FILE) $($(dfile)_SMOD_HASH_FILE)) )
$(eval $(1)_DEP_FILES_MISSING := $(filter-out $(wildcard $($(1)_DEP_MOD_SHA_FILES)),$($(1)_DEP_MOD_SHA_FILES)) )
$(if $($(1)_DEP_FILES_MISSING), $(warning "[ DPKG ] Dependecy file(s) are not found for $(1) : $($(1)_DEP_FILES_MISSING)))
$(eval $(1)_DEP_MOD_SHA := $(shell git hash-object $($(1)_DEP_MOD_SHA_FILES) \
| sha1sum | awk '{print substr($$1,0,23);}'))
endef

View File

@ -91,7 +91,11 @@ endif
include rules/config
ifeq ($(CONFIGURED_ARCH),amd64)
SLAVE_BASE_IMAGE = $(SLAVE_DIR)
else
SLAVE_BASE_IMAGE = $(SLAVE_DIR)-$(CONFIGURED_ARCH)
endif
SLAVE_IMAGE = $(SLAVE_BASE_IMAGE)-$(USER)
# Generate the version control build info
@ -101,6 +105,7 @@ $(shell SONIC_VERSION_CONTROL_COMPONENTS=$(SONIC_VERSION_CONTROL_COMPONENTS) \
# Generate the slave Dockerfile, and prepare build info for it
$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) j2 $(SLAVE_DIR)/Dockerfile.j2 > $(SLAVE_DIR)/Dockerfile)
$(shell CONFIGURED_ARCH=$(CONFIGURED_ARCH) j2 $(SLAVE_DIR)/Dockerfile.user.j2 > $(SLAVE_DIR)/Dockerfile.user)
$(shell BUILD_SLAVE=y scripts/prepare_docker_buildinfo.sh $(SLAVE_BASE_IMAGE) $(SLAVE_DIR)/Dockerfile $(CONFIGURED_ARCH) "" $(BLDENV))
# Add the versions in the tag, if the version change, need to rebuild the slave

View File

@ -1,5 +1,9 @@
ARG slave_base_tag_ref=latest
{%- if CONFIGURED_ARCH == "amd64" %}
FROM sonic-slave-buster:${slave_base_tag_ref}
{%- else %}
FROM sonic-slave-buster-{{ CONFIGURED_ARCH }}:${slave_base_tag_ref}
{%- endif %}
# Add user
ARG user

View File

@ -1,5 +1,9 @@
ARG slave_base_tag_ref=latest
{%- if CONFIGURED_ARCH == "amd64" %}
FROM sonic-slave-jessie:${slave_base_tag_ref}
{%- else %}
FROM sonic-slave-jessie-{{ CONFIGURED_ARCH }}:${slave_base_tag_ref}
{%- endif %}
# Add user
ARG user

View File

@ -1,5 +1,9 @@
ARG slave_base_tag_ref=latest
{%- if CONFIGURED_ARCH == "amd64" %}
FROM sonic-slave-stretch:${slave_base_tag_ref}
{%- else %}
FROM sonic-slave-stretch-{{ CONFIGURED_ARCH }}:${slave_base_tag_ref}
{%- endif %}
# Add user
ARG user