diff --git a/dockers/docker-base-gnmi/Dockerfile.j2 b/dockers/docker-base-gnmi/Dockerfile.j2 new file mode 100644 index 000000000000..e1aecca7de5d --- /dev/null +++ b/dockers/docker-base-gnmi/Dockerfile.j2 @@ -0,0 +1,30 @@ +{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} +FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} + +ARG docker_container_name +ARG image_version + +## Make apt-get non-interactive +ENV DEBIAN_FRONTEND=noninteractive + +# Pass the image_version to container +ENV IMAGE_VERSION=$image_version + +RUN apt-get update + +{% if docker_base_gnmi_debs.strip() -%} +# Copy locally-built Debian package dependencies +{{ copy_files("debs/", docker_base_gnmi_debs.split(' '), "/debs/") }} + +# Install locally-built Debian packages and implicitly install their dependencies +{{ install_debian_packages(docker_base_gnmi_debs.split(' ')) }} +{%- endif %} + +RUN apt-get clean -y && \ + apt-get autoclean - && \ + apt-get autoremove -y && \ + rm -rf /debs + +COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] + +ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-sonic-gnmi/Dockerfile.j2 b/dockers/docker-sonic-gnmi/Dockerfile.j2 index 962486520282..b1631d9ceed2 100644 --- a/dockers/docker-sonic-gnmi/Dockerfile.j2 +++ b/dockers/docker-sonic-gnmi/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-base-gnmi-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version @@ -28,7 +28,6 @@ RUN apt-get clean -y && \ COPY ["start.sh", "gnmi-native.sh", "dialout.sh", "/usr/bin/"] COPY ["telemetry_vars.j2", "/usr/share/sonic/templates/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] ENTRYPOINT ["/usr/local/bin/supervisord"] diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 index 88aceca4c877..d86c7c284739 100644 --- a/dockers/docker-sonic-telemetry/Dockerfile.j2 +++ b/dockers/docker-sonic-telemetry/Dockerfile.j2 @@ -1,5 +1,5 @@ {% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} -FROM docker-sonic-gnmi-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} +FROM docker-base-gnmi-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} ARG docker_container_name ARG image_version diff --git a/rules/docker-base-gnmi.dep b/rules/docker-base-gnmi.dep new file mode 100644 index 000000000000..dae333ffc1a9 --- /dev/null +++ b/rules/docker-base-gnmi.dep @@ -0,0 +1,11 @@ + +DPATH := $($(DOCKER_BASE_GNMI)_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-base-gnmi.mk rules/docker-base-gnmi.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +DEP_FILES += $(shell git ls-files $(DPATH)) + +$(DOCKER_BASE_GNMI)_CACHE_MODE := GIT_CONTENT_SHA +$(DOCKER_BASE_GNMI)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(DOCKER_BASE_GNMI)_DEP_FILES := $(DEP_FILES) + +$(eval $(call add_dbg_docker,$(DOCKER_BASE_GNMI),$(DOCKER_BASE_GNMI_DBG))) diff --git a/rules/docker-base-gnmi.mk b/rules/docker-base-gnmi.mk new file mode 100644 index 000000000000..cc89852bd515 --- /dev/null +++ b/rules/docker-base-gnmi.mk @@ -0,0 +1,22 @@ +# docker image for GNMI base + +DOCKER_BASE_GNMI_STEM = docker-base-gnmi +DOCKER_BASE_GNMI = $(DOCKER_BASE_GNMI_STEM).gz +DOCKER_BASE_GNMI_DBG = $(DOCKER_BASE_GNMI_STEM)-$(DBG_IMAGE_MARK).gz + +$(DOCKER_BASE_GNMI)_PATH = $(DOCKERS_PATH)/$(DOCKER_BASE_GNMI_STEM) + +$(DOCKER_BASE_GNMI)_DEPENDS += $(SONIC_MGMT_COMMON) +$(DOCKER_BASE_GNMI)_DEPENDS += $(SONIC_GNMI) +$(DOCKER_BASE_GNMI)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) + +$(DOCKER_BASE_GNMI)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) + +$(DOCKER_BASE_GNMI)_VERSION = 1.0.0 +$(DOCKER_BASE_GNMI)_PACKAGE_NAME = base-gnmi + +$(DOCKER_BASE_GNMI)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) + +SONIC_DOCKER_IMAGES += $(DOCKER_BASE_GNMI) +SONIC_BULLSEYE_DOCKERS += $(DOCKER_BASE_GNMI) + diff --git a/rules/docker-gnmi.mk b/rules/docker-gnmi.mk index 43cb7be2f7de..887358ba9602 100644 --- a/rules/docker-gnmi.mk +++ b/rules/docker-gnmi.mk @@ -6,16 +6,14 @@ DOCKER_GNMI_DBG = $(DOCKER_GNMI_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_GNMI)_PATH = $(DOCKERS_PATH)/$(DOCKER_GNMI_STEM) -$(DOCKER_GNMI)_DEPENDS += $(SONIC_MGMT_COMMON) -$(DOCKER_GNMI)_DEPENDS += $(SONIC_TELEMETRY) -$(DOCKER_GNMI)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS) +$(DOCKER_GNMI)_DBG_DEPENDS = $($(DOCKER_BASE_GNMI)_DBG_DEPENDS) -$(DOCKER_GNMI)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE) +$(DOCKER_GNMI)_LOAD_DOCKERS += $(DOCKER_BASE_GNMI) $(DOCKER_GNMI)_VERSION = 1.0.0 $(DOCKER_GNMI)_PACKAGE_NAME = gnmi -$(DOCKER_GNMI)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES) +$(DOCKER_GNMI)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_GNMI)_DBG_IMAGE_PACKAGES) SONIC_DOCKER_IMAGES += $(DOCKER_GNMI) SONIC_BULLSEYE_DOCKERS += $(DOCKER_GNMI) diff --git a/rules/docker-telemetry.mk b/rules/docker-telemetry.mk index 8f2324080ca6..e5aa02c527d3 100644 --- a/rules/docker-telemetry.mk +++ b/rules/docker-telemetry.mk @@ -6,14 +6,14 @@ DOCKER_TELEMETRY_DBG = $(DOCKER_TELEMETRY_STEM)-$(DBG_IMAGE_MARK).gz $(DOCKER_TELEMETRY)_PATH = $(DOCKERS_PATH)/$(DOCKER_TELEMETRY_STEM) -$(DOCKER_TELEMETRY)_DBG_DEPENDS = $($(DOCKER_GNMI)_DBG_DEPENDS) +$(DOCKER_TELEMETRY)_DBG_DEPENDS = $($(DOCKER_BASE_GNMI)_DBG_DEPENDS) -$(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_GNMI) +$(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_BASE_GNMI) $(DOCKER_TELEMETRY)_VERSION = 1.0.0 $(DOCKER_TELEMETRY)_PACKAGE_NAME = telemetry -$(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_GNMI)_DBG_IMAGE_PACKAGES) +$(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_GNMI)_DBG_IMAGE_PACKAGES) SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY) SONIC_BULLSEYE_DOCKERS += $(DOCKER_TELEMETRY) @@ -31,6 +31,9 @@ $(DOCKER_TELEMETRY)_CONTAINER_NAME = telemetry $(DOCKER_TELEMETRY)_RUN_OPT += -t $(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro $(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/timezone:/etc/timezone:ro +ifneq ($(INCLUDE_SYSTEM_GNMI), y) +$(DOCKER_TELEMETRY)_RUN_OPT += -v /var/run/dbus:/var/run/dbus:rw +endif $(DOCKER_TELEMETRY)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) $(DOCKER_TELEMETRY)_BASE_IMAGE_FILES += monit_telemetry:/etc/monit/conf.d diff --git a/rules/gnmi.dep b/rules/gnmi.dep new file mode 100644 index 000000000000..c894ca9e3d34 --- /dev/null +++ b/rules/gnmi.dep @@ -0,0 +1,13 @@ +#DPKG FRK +SPATH := $($(SONIC_GNMI)_SRC_PATH) +DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/gnmi.mk rules/gnmi.dep +DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) +SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) + + +$(SONIC_GNMI)_CACHE_MODE := GIT_CONTENT_SHA +$(SONIC_GNMI)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) +$(SONIC_GNMI)_DEP_FILES := $(DEP_FILES) +$(SONIC_GNMI)_SMDEP_FILES := $(SMDEP_FILES) +$(SONIC_GNMI)_SMDEP_PATHS := $(SPATH) + diff --git a/rules/gnmi.mk b/rules/gnmi.mk new file mode 100644 index 000000000000..ac4e8e77fc3c --- /dev/null +++ b/rules/gnmi.mk @@ -0,0 +1,8 @@ +# SONiC telemetry package + +SONIC_GNMI = sonic-gnmi_0.1_$(CONFIGURED_ARCH).deb +$(SONIC_GNMI)_SRC_PATH = $(SRC_PATH)/sonic-gnmi +$(SONIC_GNMI)_DEPENDS = $(SONIC_MGMT_COMMON) $(SONIC_MGMT_COMMON_CODEGEN) \ + $(LIBSWSSCOMMON_DEV) $(LIBSWSSCOMMON) +$(SONIC_GNMI)_RDEPENDS = $(LIBSWSSCOMMON) +SONIC_DPKG_DEBS += $(SONIC_GNMI) diff --git a/rules/telemetry.dep b/rules/telemetry.dep deleted file mode 100644 index d759b3acac21..000000000000 --- a/rules/telemetry.dep +++ /dev/null @@ -1,13 +0,0 @@ -#DPKG FRK -SPATH := $($(SONIC_TELEMETRY)_SRC_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/telemetry.mk rules/telemetry.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) -SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files)) - - -$(SONIC_TELEMETRY)_CACHE_MODE := GIT_CONTENT_SHA -$(SONIC_TELEMETRY)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(SONIC_TELEMETRY)_DEP_FILES := $(DEP_FILES) -$(SONIC_TELEMETRY)_SMDEP_FILES := $(SMDEP_FILES) -$(SONIC_TELEMETRY)_SMDEP_PATHS := $(SPATH) - diff --git a/rules/telemetry.mk b/rules/telemetry.mk deleted file mode 100644 index 4739871e4704..000000000000 --- a/rules/telemetry.mk +++ /dev/null @@ -1,8 +0,0 @@ -# SONiC telemetry package - -SONIC_TELEMETRY = sonic-gnmi_0.1_$(CONFIGURED_ARCH).deb -$(SONIC_TELEMETRY)_SRC_PATH = $(SRC_PATH)/sonic-gnmi -$(SONIC_TELEMETRY)_DEPENDS = $(SONIC_MGMT_COMMON) $(SONIC_MGMT_COMMON_CODEGEN) \ - $(LIBSWSSCOMMON_DEV) $(LIBSWSSCOMMON) -$(SONIC_TELEMETRY)_RDEPENDS = $(LIBSWSSCOMMON) -SONIC_DPKG_DEBS += $(SONIC_TELEMETRY)