Skip to content

Commit

Permalink
[docker-base]: Enabled common debug packages installation. (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpatenko authored and lguohan committed Feb 22, 2017
1 parent f57fd0b commit a2b4bcb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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/*;

3 changes: 3 additions & 0 deletions rules/config
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 9 additions & 1 deletion rules/docker-base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 > $@
Expand Down

0 comments on commit a2b4bcb

Please sign in to comment.