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
parent 9fa4aa85
FROM alpine:latest
RUN apk --no-cache add py-pip
RUN pip install awscli
RUN apk --no-cache add py-pip \
&& pip install --no-cache-dir awscli
......@@ -6,6 +6,8 @@ ADD /scripts/ /scripts/
RUN apt-get update \
&& apt-get install -y git \
&& /scripts/install-node 8.x 1.2.1-1 \
&& apt-get autoremove -yq \
&& apt-get clean -yqq \
&& rm -rf /var/lib/apt/lists/* \
&& gem install danger-gitlab --no-document \
&& git version \
......
FROM node:10-jessie
# Workaround for https://github.com/GoogleChrome/puppeteer/issues/290
RUN apt-get update && apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget && rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \
&& apt-get autoremove -yq \
&& apt-get clean -yqq \
&& rm -rf /var/lib/apt/lists/*
......@@ -2,6 +2,8 @@ FROM ubuntu:18.04
RUN apt-get update -q \
&& apt-get install -y g++ gcc git make curl zlib1g-dev libssl1.0-dev locales \
&& apt-get autoremove -yq \
&& apt-get clean -yqq \
&& rm -rf /var/lib/apt/lists/*
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
......
FROM centos:centos6
RUN yum update -y -q
RUN yum groupinstall -y Development Tools
RUN yum install -y \
gcc gcc-c++ git make curl zlib-devel openssl-devel
RUN yum update -y -q \
&& yum groupinstall -y Development Tools \
&& yum install -y \
gcc gcc-c++ git make curl zlib-devel openssl-devel \
&& yum clean all
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
......
FROM centos:centos7
RUN yum update -y -q
RUN yum groupinstall -y Development Tools
RUN yum install -y \
gcc gcc-c++ git make curl zlib-devel openssl-devel
RUN yum update -y -q \
&& yum groupinstall -y Development Tools \
&& yum install -y \
gcc gcc-c++ git make curl zlib-devel openssl-devel \
&& yum clean all
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
......
......@@ -2,6 +2,8 @@ FROM debian:jessie
RUN apt-get update -q \
&& apt-get install -y g++ gcc git make curl zlib1g-dev libssl-dev locales\
&& apt-get autoremove -yq \
&& apt-get clean -yqq \
&& rm -rf /var/lib/apt/lists/*
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
......
FROM opensuse:42.3
RUN zypper -q -n --gpg-auto-import-keys update
RUN zypper -q -n in -t pattern devel_perl devel_basis
RUN zypper -q -n install \
gcc gcc-c++ git make curl zlib-devel libopenssl-devel glibc-i18ndata glibc-locale
RUN zypper -q -n --gpg-auto-import-keys update \
&& zypper -q -n in -t pattern devel_perl devel_basis \
&& zypper -q -n install \
gcc gcc-c++ git make curl zlib-devel libopenssl-devel glibc-i18ndata glibc-locale \
&& zypper clean -a
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
......
......@@ -2,6 +2,8 @@ FROM debian:stretch
RUN apt-get update -q \
&& apt-get install -y g++ gcc git make curl zlib1g-dev libssl1.0-dev locales \
&& apt-get autoremove -yq \
&& apt-get clean -yqq \
&& rm -rf /var/lib/apt/lists/*
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
......
......@@ -2,6 +2,8 @@ FROM ubuntu:14.04
RUN apt-get update -q \
&& apt-get install -y g++ gcc git make curl zlib1g-dev libssl-dev \
&& apt-get autoremove -yq \
&& apt-get clean -yqq \
&& rm -rf /var/lib/apt/lists/*
ENV RUBY_VERSION 2.4.4
......
......@@ -2,6 +2,8 @@ FROM debian:wheezy
RUN apt-get update -q \
&& apt-get install -y g++ gcc git make libc6-dev curl zlib1g-dev libssl-dev locales \
&& apt-get autoremove -yq \
&& apt-get clean -yqq \
&& rm -rf /var/lib/apt/lists/*
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
......
......@@ -2,6 +2,8 @@ FROM ubuntu:16.04
RUN apt-get update -q \
&& apt-get install -y g++ gcc git make curl zlib1g-dev libssl-dev locales \
&& apt-get autoremove -yq \
&& apt-get clean -yqq \
&& rm -rf /var/lib/apt/lists/*
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
......
FROM ruby:2.4-alpine
RUN apk add --update build-base cmake git openssh-client
RUN apk add --update --no-cache build-base cmake git openssh-client
# Set UTF-8 http://jaredmarkell.com/docker-and-locales/
ENV LANG en_US.UTF-8
......
......@@ -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/*
......@@ -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/*
......@@ -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/*
......@@ -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/*
......@@ -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/*
......@@ -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/*
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment