[docker-base]: Enabled common debug packages installation. (#292)

This commit is contained in:
antonpatenko 2017-02-22 05:04:43 +02:00 committed by lguohan
parent f57fd0bee8
commit a2b4bcbb61
5 changed files with 22 additions and 2 deletions

1
.gitignore vendored
View File

@ -32,4 +32,5 @@ dockers/docker-snmp-sv2/Dockerfile
dockers/docker-team/Dockerfile
dockers/docker-teamd/Dockerfile
dockers/docker-config-engine/Dockerfile
dockers/docker-base/Dockerfile
platform/broadcom/docker-syncd-brcm/Dockerfile

View File

@ -36,9 +36,16 @@ RUN apt-get -y purge \
exim4-config \
exim4-daemon-light
{% if docker_base_dbgs %}
## Install common debug-packages
RUN apt-get -y install \
{% for dbg_pkg in docker_base_dbgs.split(' ') -%}
{{ dbg_pkg }}{{' '}}
{%- endfor %}
{% endif %}
## Clean up apt
## Remove /var/lib/apt/lists/*, could be obsoleted for derived images
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y; \
rm -rf /var/lib/apt/lists/*; \
rm -rf /tmp/*;

View File

@ -42,3 +42,6 @@ PASSWORD = YourPaSsWoRd
# If not set (default behavior) the default minigraph built into the image will be used.
# ENABLE_DHCP_GRAPH_SERVICE = y
# SONIC_CONFIG_DEBUG - install debug packages
# Uncomment next line to enable:
# SONIC_CONFIG_DEBUG = y

View File

@ -3,4 +3,12 @@
DOCKER_BASE = docker-base.gz
$(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base
SONIC_SIMPLE_DOCKER_IMAGES += $(DOCKER_BASE)
ifeq ($(SONIC_CONFIG_DEBUG),y)
GDB = gdb
VIM = vim
OPENSSH = openssh-client
SSHPASS = sshpass
$(DOCKER_BASE)_DBG_PACKAGES += $(GDB) $(VIM) $(OPENSSH) $(SSHPASS)
endif
SONIC_DOCKER_IMAGES += $(DOCKER_BASE)

View File

@ -267,6 +267,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .pl
sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG)
# Export variables for j2. Use path for unique variable names, e.g. docker_orchagent_debs
$(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++'))
$(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_dbgs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DBG_PACKAGES)))\n" | awk '!a[$$0]++'))
j2 $($*.gz_PATH)/Dockerfile.j2 > $($*.gz_PATH)/Dockerfile
docker build --squash --no-cache -t $* $($*.gz_PATH) $(LOG)
docker save $* | gzip -c > $@