Remove amphora-agent build deps

The amphora-agent element installs a few build packages when installing
the agent from source. This patch removes those large in size packages
after they are no longer needed. This will reduce the
image size significantly.

Co-Authored-By: Michael Johnson <johnsomor@gmail.com>

Change-Id: I5d12b7a987f65013daa5298f5062c1f30db23f41
This commit is contained in:
Carlos Goncalves 2019-02-25 15:51:25 +00:00
parent 6e4da85064
commit a04e3e3741
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
[ "${DIB_INSTALLTYPE_amphora_agent:-}" = "package" ] && exit 0
git --git-dir=/opt/amphora-agent/.git rev-parse HEAD >> /opt/amphora-agent.gitref
rm -rf /opt/amphora-agent
case $DISTRO_NAME in
ubuntu | debian )
apt-get --assume-yes purge --auto-remove build-essential libffi-dev libssl-dev python-dev python3-dev git
;;
fedora | centos* | rhel* )
YUM=${YUM:-yum}
${YUM} -v -y autoremove automake make gcc gcc-c++ kernel-devel libffi-devel openssl-devel python-devel platform-python-devel python{2,3,}-pip git
;;
*)
echo "ERROR: Unsupported distribution $DISTRO_NAME"
exit 1
;;
esac