[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 # Autogenerated Dockerfiles
sonic-slave*/Dockerfile sonic-slave*/Dockerfile
sonic-slave*/Dockerfile.user
dockers/*/Dockerfile dockers/*/Dockerfile
platform/*/docker-*/Dockerfile platform/*/docker-*/Dockerfile

View File

@ -72,9 +72,9 @@ SONIC_COMMON_FLAGS_LIST := $(CONFIGURED_PLATFORM) \
$(SONIC_PROFILING_ON) $(SONIC_ENABLE_SYNCD_RPC) $(SONIC_PROFILING_ON) $(SONIC_ENABLE_SYNCD_RPC)
SONIC_COMMON_DPKG_LIST := debian/control debian/changelog debian/rules \ SONIC_COMMON_DPKG_LIST := debian/control debian/changelog debian/rules \
debian/compat debian/install debian/copyright debian/compat debian/install debian/copyright
SONIC_COMMON_BASE_FILES_LIST := sonic-slave-jessie/Dockerfile.j2 sonic-slave-jessie/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 \ sonic-slave-stretch/Dockerfile.j2 sonic-slave-stretch/Dockerfile.user.j2 \
sonic-slave-buster/Dockerfile.j2 sonic-slave-buster/Dockerfile.user sonic-slave-buster/Dockerfile.j2 sonic-slave-buster/Dockerfile.user.j2

View File

@ -91,7 +91,11 @@ endif
include rules/config include rules/config
ifeq ($(CONFIGURED_ARCH),amd64)
SLAVE_BASE_IMAGE = $(SLAVE_DIR) SLAVE_BASE_IMAGE = $(SLAVE_DIR)
else
SLAVE_BASE_IMAGE = $(SLAVE_DIR)-$(CONFIGURED_ARCH)
endif
SLAVE_IMAGE = $(SLAVE_BASE_IMAGE)-$(USER) SLAVE_IMAGE = $(SLAVE_BASE_IMAGE)-$(USER)
# Generate the version control build info # 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 # 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.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)) $(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 # 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 ARG slave_base_tag_ref=latest
{%- if CONFIGURED_ARCH == "amd64" %}
FROM sonic-slave-buster:${slave_base_tag_ref} FROM sonic-slave-buster:${slave_base_tag_ref}
{%- else %}
FROM sonic-slave-buster-{{ CONFIGURED_ARCH }}:${slave_base_tag_ref}
{%- endif %}
# Add user # Add user
ARG user ARG user

View File

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

View File

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