From bfb556645b6d17e0a9175a53ef14f7bf9a7971f2 Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Wed, 20 Jul 2016 23:10:54 +0200 Subject: [PATCH] Extract `etc` files from openstack packages Extract the required files from openstack packages instead of installing the entire set of packages. This cuts the image size by ~500MB. Change-Id: Id5a2519d5471c25b44c3ad7ce441d9bae3cae651 --- heat_docker_agent/configure_container.sh | 39 +++++++++++++++++------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/heat_docker_agent/configure_container.sh b/heat_docker_agent/configure_container.sh index 1b601f575..ef6258cb6 100755 --- a/heat_docker_agent/configure_container.sh +++ b/heat_docker_agent/configure_container.sh @@ -33,18 +33,35 @@ yum install -y \ puppet \ python-ipaddr -# openstack packages -yum install -y \ - openstack-ceilometer-compute \ - python-nova \ - openstack-nova-common \ - openstack-neutron \ - libvirt-daemon-config-nwfilter \ - libvirt-daemon-kvm \ - openstack-nova-compute \ - openstack-neutron-ml2 \ - openstack-neutron-openvswitch +# NOTE(flaper87): openstack packages +# We need these packages just to install the config files. +# Instead of installing the entire package, we'll extract the +# config files from the RPM and put them in place. This step will +# save us ~500 MB in the final size of the image. +yum install -y --downloadonly --downloaddir=/tmp/packages \ + openstack-ceilometer-compute \ + python-nova \ + openstack-nova-common \ + openstack-neutron \ + libvirt-daemon-config-nwfilter \ + libvirt-daemon-kvm \ + openstack-nova-compute \ + openstack-neutron-ml2 \ + openstack-neutron-openvswitch +CUR=`pwd` +cd /tmp/packages +for f in $(ls openstack-*.rpm); +do + rpm2cpio $f | cpio -ivd ./etc/* + + if [ -d 'etc' ]; + then + cp -r etc/* /etc + rm -Rf etc + fi +done +cd $CUR && rm -Rf /tmp/packages # Also note gcc, python-devel, and libyaml-devel are required for # docker-compose. It would be nice to package that or use somethinge else.