Add `yum/dnf clean all` to dockerfiles

In a rather desperate try to shrink our container images this commit
adds `yum/dnf clean all` as part of the building process. This helps to
save around 100 MB in case of centos-based images.

Change-Id: I2aaadab4ffec6e0ad744e82fc9145cd86e14a224
This commit is contained in:
Michał Dulko 2019-04-16 19:49:00 +02:00
parent 1fc669c3d6
commit e685d72800
4 changed files with 4 additions and 0 deletions

View File

@ -15,6 +15,7 @@ RUN pip install -c $UPPER_CONSTRAINTS_FILE /opt/kuryr-kubernetes \
&& mkdir -p /etc/kuryr-cni \
&& cp /opt/kuryr-kubernetes/etc/cni/net.d/* /etc/kuryr-cni \
&& yum -y history undo last \
&& yum clean all \
&& rm -rf /opt/kuryr-kubernetes \
&& mkdir ${OSLO_LOCK_PATH}

View File

@ -16,6 +16,7 @@ RUN python3.6 -m ensurepip \
&& mkdir -p /etc/kuryr-cni \
&& cp /opt/kuryr-kubernetes/etc/cni/net.d/* /etc/kuryr-cni \
&& dnf -y history undo last \
&& dnf clean all \
&& rm -rf /opt/kuryr-kubernetes \
&& mkdir ${OSLO_LOCK_PATH}

View File

@ -11,6 +11,7 @@ COPY . /opt/kuryr-kubernetes
RUN pip install -c $UPPER_CONSTRAINTS_FILE --no-cache-dir /opt/kuryr-kubernetes \
&& yum -y history undo last \
&& yum clean all \
&& rm -rf /opt/kuryr-kubernetes \
&& groupadd -r kuryr -g 711 \
&& useradd -u 711 -g kuryr \

View File

@ -12,6 +12,7 @@ COPY . /opt/kuryr-kubernetes
RUN python3.6 -m ensurepip \
&& python3.6 -m pip install -c $UPPER_CONSTRAINTS_FILE --no-cache-dir /opt/kuryr-kubernetes \
&& dnf -y history undo last \
&& dnf clean all \
&& rm -rf /opt/kuryr-kubernetes \
&& groupadd -r kuryr -g 711 \
&& useradd -u 711 -g kuryr \