Skip to content

Commit

Permalink
[build]: add arch name in sonic-slave docker image
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
lguohan committed Dec 25, 2020
1 parent 2999dfa commit 512eb6b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ target/

# Autogenerated Dockerfiles
sonic-slave*/Dockerfile
sonic-slave*/Dockerfile.user
dockers/*/Dockerfile
platform/*/docker-*/Dockerfile

Expand Down
8 changes: 4 additions & 4 deletions Makefile.cache
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 512eb6b

Please sign in to comment.