Ensure that package managers clean up

Every package manager should clean up after themselves in order to keep
docker layers neat and tiny:

apt (Debian/Ubuntu package manager):

 - unneeded dependencies are cleared (autoremove)
 - caches are cleaned (clean)
 - package lists are deleted

yum (CentOS package manager),
zypper (OpenSuse package manager)

 - should clear caches after installing dependencies

pip (Python package manager),
apk (Alpine package manager)

 - should use no cache for installing dependencies
This commit is contained in:
Lukas Eipert 2018-10-04 14:38:17 +02:00
parent 9fa4aa85c2
commit 5380948868
No known key found for this signature in database
GPG key ID: 148BEA37CB35B2AC
19 changed files with 62 additions and 27 deletions

View file

@ -6,7 +6,10 @@ ANSIBLE_VERSION=$1
apt-get update
apt-get install -y python-pip python-dev
apt-get clean -yqq
pip install --upgrade cffi
pip install "ansible==${ANSIBLE_VERSION}"
pip install --no-cache-dir --upgrade cffi
pip install --no-cache-dir "ansible==${ANSIBLE_VERSION}"
apt-get autoremove -yq
apt-get clean -yqq
rm -rf /var/lib/apt/lists/*

View file

@ -35,3 +35,7 @@ rm -rf /var/lib/apt/lists/*
wget -q https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
unzip chromedriver_linux64.zip -d /usr/local/bin
rm -f chromedriver_linux64.zip
apt-get autoremove -yq
apt-get clean -yqq
rm -rf /var/lib/apt/lists/*

View file

@ -16,8 +16,6 @@ apt-get install -y \
libkrb5-dev postgresql-client mysql-client unzip \
libre2-dev gettext \
apt-get clean -yqq
# Set UTF-8
# http://stackoverflow.com/a/3182519/2137281
LOC=$'LC_ALL=en_US.UTF-8\nLANG=en_US.UTF-8'
@ -28,4 +26,6 @@ locale-gen
dpkg-reconfigure locales -f noninteractive -p critical
locale -a
apt-get autoremove -yq
apt-get clean -yqq
rm -rf /var/lib/apt/lists/*

View file

@ -15,3 +15,7 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.lis
apt-get update
apt-get install -y nodejs yarn=$YARN_INSTALL_VERSION
apt-get autoremove -yq
apt-get clean -yqq
rm -rf /var/lib/apt/lists/*

View file

@ -10,4 +10,7 @@ echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg ${POSTGRES_VERSIO
apt-get update
apt-get install -y postgresql-client
apt-get autoremove -yq
apt-get clean -yqq
rm -rf /var/lib/apt/lists/*

View file

@ -11,7 +11,6 @@ apt-get install -yq --no-install-recommends \
git-core pandoc texlive-latex-recommended texlive-xetex \
texlive-fonts-recommended lmodern ed file curl gnupg2
apt-get autoremove -yq
# Set UTF-8
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
@ -19,4 +18,6 @@ locale-gen
update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 LC_ALL=en_US.UTF-8
locale -a
apt-get autoremove -yq
apt-get clean -yqq
rm -rf /var/lib/apt/lists/*