Cleanup APT lists after installing packages
/var/lib/apt/lists/ can take several MBs so get rid of them after packages are installed. Change-Id: Icfff55d92fa5c865f09db5112da28bf452a5a221
This commit is contained in:
parent
93b91ceef6
commit
4de0706190
@ -268,7 +268,8 @@ COPY dpkg_reducing_disk_footprint /etc/dpkg/dpkg.cfg.d/dpkg_reducing_disk_footpr
|
||||
# apt-get update will not work if any repositories are accessed via HTTPS
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install --no-install-recommends apt-transport-https ca-certificates gnupg dirmngr curl \
|
||||
&& apt-get clean
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
{% endblock %}
|
||||
|
||||
{% block base_ubuntu_package_sources_list %}
|
||||
@ -365,7 +366,8 @@ RUN apt-get update \
|
||||
{%- for package in base_apt_packages | customizable('apt_packages') %}
|
||||
{{ package }} \
|
||||
{%- endfor %}
|
||||
&& apt-get clean
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
{% endblock %}
|
||||
|
||||
{% if base_distro == 'ubuntu' %}
|
||||
|
@ -31,11 +31,16 @@ RUN sed -e "s/.*mariadb.*//Ig" -i /etc/apt/sources.list && apt-get purge -y mari
|
||||
{% endif %}
|
||||
|
||||
{% block bifrost_ansible_install %}
|
||||
RUN bash -c './scripts/env-setup.sh && source ./env-vars && \
|
||||
{% if base_distro in ['debian', 'ubuntu'] %}
|
||||
RUN apt-get update && \
|
||||
{% else %}
|
||||
RUN echo " " && \
|
||||
{% endif %}
|
||||
bash -c './scripts/env-setup.sh && source ./env-vars && \
|
||||
ansible-playbook -vvvv -i /bifrost/playbooks/inventory/target /bifrost/playbooks/install.yaml \
|
||||
-e @/tmp/build_arg.yml && \
|
||||
{% if base_distro in ['debian', 'ubuntu'] %}
|
||||
apt-get clean'
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*'
|
||||
{% else %}
|
||||
yum clean all'
|
||||
{% endif %}
|
||||
|
@ -49,10 +49,12 @@ RUN usermod --append --home {{ homedir }} --groups kolla {{ name }} \
|
||||
|
||||
{% macro debian_haproxy_existing_user_fix() %}
|
||||
{# NOTE(SamYaple): The postinst script breaks if the user 'haproxy' already exists #}
|
||||
RUN apt-get -y install --no-install-recommends haproxy \
|
||||
RUN apt-get update \
|
||||
&& apt-get -y install --no-install-recommends haproxy \
|
||||
|| sed -i '/^adduser/,+1 d' /var/lib/dpkg/info/haproxy.postinst \
|
||||
&& apt-get -y install -f \
|
||||
&& apt-get clean
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
{% endmacro %}
|
||||
|
||||
{% macro debian_opendaylight_existing_user_fix() %}
|
||||
@ -61,7 +63,8 @@ RUN apt-get update \
|
||||
&& apt-get -y install --no-install-recommends opendaylight \
|
||||
|| sed -i '/^\s*adduser/,+1 d' /var/lib/dpkg/info/opendaylight.postinst \
|
||||
&& apt-get -y install -f \
|
||||
&& apt-get clean
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
{% endmacro %}
|
||||
|
||||
{% macro install_kubectl() %}
|
||||
|
@ -49,6 +49,7 @@ def debian_package_install(packages):
|
||||
' '.join(reg_packages)
|
||||
))
|
||||
cmds.append('apt-get clean')
|
||||
cmds.append('rm -rf /var/lib/apt/lists/*')
|
||||
|
||||
# handle URL packages
|
||||
for url in url_packages:
|
||||
|
Loading…
Reference in New Issue
Block a user