From 0eeb249fd85668b6d26a1a3401f43b81375afeb3 Mon Sep 17 00:00:00 2001 From: Lawrence Lee Date: Tue, 17 May 2022 13:55:59 -0700 Subject: [PATCH] [swss]: Convert swss docker to bullseye (#10484) * [swss]: Convert swss docker to bullseye Signed-off-by: Lawrence Lee --- dockers/docker-orchagent/Dockerfile.j2 | 13 +++-------- .../docker-swss-layer-bullseye/Dockerfile.j2 | 22 +++++++++++++++++++ rules/docker-orchagent.mk | 9 +++----- rules/docker-swss-layer-bullseye.dep | 9 ++++++++ rules/docker-swss-layer-bullseye.mk | 14 ++++++++++++ 5 files changed, 51 insertions(+), 16 deletions(-) create mode 100644 dockers/docker-swss-layer-bullseye/Dockerfile.j2 create mode 100644 rules/docker-swss-layer-bullseye.dep create mode 100644 rules/docker-swss-layer-bullseye.mk diff --git a/dockers/docker-orchagent/Dockerfile.j2 b/dockers/docker-orchagent/Dockerfile.j2 index adb084cf22..a023862c1d 100755 --- a/dockers/docker-orchagent/Dockerfile.j2 +++ b/dockers/docker-orchagent/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-swss-layer-buster-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-swss-layer-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf @@ -26,17 +26,10 @@ RUN apt-get update && \ {% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %} # Fix for gcc/python/iputils-ping not found in arm docker -RUN apt-get install -f -y python2.7 python2.7-dev RUN apt-get install -y \ - gcc-8 \ + gcc \ iputils-ping {% endif %} -{% if CONFIGURED_ARCH == "armhf" %} -RUN ln -s -f /usr/bin/gcc-8 /usr/bin/arm-linux-gnueabihf-gcc -{% endif %} -{% if CONFIGURED_ARCH == "arm64" %} -RUN ln -s -f /usr/bin/gcc-8 /usr/bin/aarch64-linux-gnu-gcc -{% endif %} # Dependencies of restore_neighbors.py RUN pip3 install \ @@ -45,7 +38,7 @@ RUN pip3 install \ {% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %} # Remove installed gcc -RUN apt-get remove -y gcc-8 +RUN apt-get remove -y gcc {% endif %} {% if docker_orchagent_debs.strip() -%} diff --git a/dockers/docker-swss-layer-bullseye/Dockerfile.j2 b/dockers/docker-swss-layer-bullseye/Dockerfile.j2 new file mode 100644 index 0000000000..15f0e0edcc --- /dev/null +++ b/dockers/docker-swss-layer-bullseye/Dockerfile.j2 @@ -0,0 +1,22 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update + +{% if docker_swss_layer_bullseye_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_swss_layer_bullseye_debs.split(' '), "/debs/") }} + +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_swss_layer_bullseye_debs.split(' ')) }} +{%- endif %} + +RUN apt-get clean -y && \ + apt-get autoclean -y && \ + apt-get autoremove -y && \ + rm -rf /debs + +ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/rules/docker-orchagent.mk b/rules/docker-orchagent.mk index ef0c203877..917fe0b136 100644 --- a/rules/docker-orchagent.mk +++ b/rules/docker-orchagent.mk @@ -6,17 +6,17 @@ DOCKER_ORCHAGENT_DBG = $(DOCKER_ORCHAGENT_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_ORCHAGENT)_DEPENDS += $(SWSS) -$(DOCKER_ORCHAGENT)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_DEPENDS) +$(DOCKER_ORCHAGENT)_DBG_DEPENDS = $($(DOCKER_SWSS_LAYER_BULLSEYE)_DBG_DEPENDS) $(DOCKER_ORCHAGENT)_DBG_DEPENDS += $(SWSS_DBG) \ $(LIBSWSSCOMMON_DBG) \ $(LIBSAIREDIS_DBG) $(DOCKER_ORCHAGENT)_PYTHON_WHEELS += $(SCAPY) -$(DOCKER_ORCHAGENT)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BUSTER)_DBG_IMAGE_PACKAGES) +$(DOCKER_ORCHAGENT)_DBG_IMAGE_PACKAGES = $($(DOCKER_SWSS_LAYER_BULLSEYE)_DBG_IMAGE_PACKAGES) $(DOCKER_ORCHAGENT)_PATH = $(DOCKERS_PATH)/$(DOCKER_ORCHAGENT_STEM) -$(DOCKER_ORCHAGENT)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_BUSTER) +$(DOCKER_ORCHAGENT)_LOAD_DOCKERS += $(DOCKER_SWSS_LAYER_BULLSEYE) $(DOCKER_ORCHAGENT)_VERSION = 1.0.0 $(DOCKER_ORCHAGENT)_PACKAGE_NAME = swss @@ -39,6 +39,3 @@ $(DOCKER_ORCHAGENT)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw $(DOCKER_ORCHAGENT)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel $(DOCKER_ORCHAGENT)_FILES += $(ARP_UPDATE_SCRIPT) $(ARP_UPDATE_VARS_TEMPLATE) $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) - -SONIC_BUSTER_DOCKERS += $(DOCKER_ORCHAGENT) -SONIC_BUSTER_DBG_DOCKERS += $(DOCKER_ORCHAGENT_DBG) diff --git a/rules/docker-swss-layer-bullseye.dep b/rules/docker-swss-layer-bullseye.dep new file mode 100644 index 0000000000..102405a467 --- /dev/null +++ b/rules/docker-swss-layer-bullseye.dep @@ -0,0 +1,9 @@ + +DPATH := $($(DOCKER_SWSS_LAYER_BULLSEYE)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-swss-layer-bullseye.mk rules/docker-swss-layer-bullseye.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_SWSS_LAYER_BULLSEYE)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_SWSS_LAYER_BULLSEYE)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_SWSS_LAYER_BULLSEYE)_DEP_FILES := $(DEP_FILES) diff --git a/rules/docker-swss-layer-bullseye.mk b/rules/docker-swss-layer-bullseye.mk new file mode 100644 index 0000000000..aebbbc122a --- /dev/null +++ b/rules/docker-swss-layer-bullseye.mk @@ -0,0 +1,14 @@ +# bullseye-based docker image for sonic swss layer + +DOCKER_SWSS_LAYER_BULLSEYE= docker-swss-layer-bullseye.gz +$(DOCKER_SWSS_LAYER_BULLSEYE)_PATH = $(DOCKERS_PATH)/docker-swss-layer-bullseye + +$(DOCKER_SWSS_LAYER_BULLSEYE)_DEPENDS += $(SWSS) +$(DOCKER_SWSS_LAYER_BULLSEYE)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) + +$(DOCKER_SWSS_LAYER_BULLSEYE)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) \ + $(SWSS) +$(DOCKER_SWSS_LAYER_BULLSEYE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) + +SONIC_DOCKER_IMAGES += $(DOCKER_SWSS_LAYER_BULLSEYE) +SONIC_BULLSEYE_DOCKERS += $(DOCKER_SWSS_LAYER_BULLSEYE)