Remove unused packages in docker images and host (#2807)
* Remove unneeded packages in docker images and host * Remove libpython3.6 from snmp docker image
This commit is contained in:
parent
b186bb2c4c
commit
6b3a26f0cc
@ -73,6 +73,10 @@ RUN apt-get -y install {{ dbg_pkg }}
|
|||||||
RUN ln /usr/bin/vim.tiny /usr/bin/vim
|
RUN ln /usr/bin/vim.tiny /usr/bin/vim
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
# Remove python3.4
|
||||||
|
# Note: if later python3 is required by more docker images, consider install homebrew python3 here instead of in SNMP image only
|
||||||
|
RUN apt-get purge -y libpython3.4-minimal
|
||||||
|
|
||||||
# Clean up apt
|
# Clean up apt
|
||||||
# Remove /var/lib/apt/lists/*, could be obsoleted for derived images
|
# Remove /var/lib/apt/lists/*, could be obsoleted for derived images
|
||||||
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||||
|
@ -43,5 +43,5 @@ python-wheels/{{ whl }}{{' '}}
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get remove -y python-pip python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
RUN apt-get purge -y python-pip python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||||
RUN rm -rf /debs /python-wheels
|
RUN rm -rf /debs /python-wheels
|
||||||
|
@ -43,5 +43,5 @@ python-wheels/{{ whl }}{{' '}}
|
|||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
RUN apt-get remove -y python-pip python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
RUN apt-get purge -y python-pip python-dev; apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||||
RUN rm -rf /debs /python-wheels
|
RUN rm -rf /debs /python-wheels
|
||||||
|
@ -35,7 +35,7 @@ RUN pip install /python-wheels/{{ whl }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
RUN apt-get remove -y python-pip
|
RUN apt-get purge -y python-pip
|
||||||
RUN apt-get clean -y
|
RUN apt-get clean -y
|
||||||
RUN apt-get autoclean -y
|
RUN apt-get autoclean -y
|
||||||
RUN apt-get autoremove -y
|
RUN apt-get autoremove -y
|
||||||
|
@ -46,7 +46,7 @@ RUN pip install /python-wheels/{{ whl }}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
RUN apt-get remove -y python-pip
|
RUN apt-get purge -y python-pip
|
||||||
RUN apt-get clean -y
|
RUN apt-get clean -y
|
||||||
RUN apt-get autoclean -y
|
RUN apt-get autoclean -y
|
||||||
RUN apt-get autoremove -y
|
RUN apt-get autoremove -y
|
||||||
|
@ -60,7 +60,9 @@ RUN pip install /python-wheels/{{ whl }}
|
|||||||
RUN python3.6 -m sonic_ax_impl install
|
RUN python3.6 -m sonic_ax_impl install
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
RUN apt-get -y purge libpython3.6-dev curl gcc make libdpkg-perl
|
RUN apt-get -y purge libpython3.6-dev libpython3.6 curl gcc make libdpkg-perl
|
||||||
|
# Note: these packages should be removed with autoremove but actually not, so explicitly purged
|
||||||
|
RUN apt-get -y purge libldap-2.4-2 libsasl2-2 libsasl2-modules libsasl2-modules-db
|
||||||
RUN apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y --purge
|
RUN apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y --purge
|
||||||
RUN find / | grep -E "__pycache__" | xargs rm -rf
|
RUN find / | grep -E "__pycache__" | xargs rm -rf
|
||||||
RUN rm -rf /debs /python-wheels ~/.cache
|
RUN rm -rf /debs /python-wheels ~/.cache
|
||||||
|
@ -29,9 +29,9 @@ RUN apt-get install -y default-jre
|
|||||||
RUN apt-get install -y rsyslog psmisc
|
RUN apt-get install -y rsyslog psmisc
|
||||||
|
|
||||||
# Remove cffi 1.5.2, will install 1.10.0 by pip later
|
# Remove cffi 1.5.2, will install 1.10.0 by pip later
|
||||||
RUN apt-get remove -y python-cffi python-cffi-backend
|
RUN apt-get purge -y python-cffi python-cffi-backend
|
||||||
# Remove pycparser 2.14, will install >=2.17 by pip later
|
# Remove pycparser 2.14, will install >=2.17 by pip later
|
||||||
RUN apt-get remove -y python-ply python-pycparser
|
RUN apt-get purge -y python-ply python-pycparser
|
||||||
|
|
||||||
RUN easy_install pip
|
RUN easy_install pip
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ sudo LANG=C cp $SCRIPTS_DIR/syncd.sh $FILESYSTEM_ROOT/usr/local/bin/syncd.sh
|
|||||||
sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT/etc/systemd/system/
|
sudo cp $BUILD_TEMPLATES/snmp.timer $FILESYSTEM_ROOT/etc/systemd/system/
|
||||||
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable snmp.timer
|
sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable snmp.timer
|
||||||
|
|
||||||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get remove -y python-dev
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get purge -y python-dev
|
||||||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get clean -y
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get clean -y
|
||||||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get autoremove -y
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get autoremove -y
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ $(PY3_MIN)_RDEPENDS += $(LIBPY3_MIN)
|
|||||||
|
|
||||||
PY3 = $(PYTHON_PNAME)_$(PYTHON_VER)_amd64.deb
|
PY3 = $(PYTHON_PNAME)_$(PYTHON_VER)_amd64.deb
|
||||||
$(eval $(call add_derived_package,$(LIBPY3_MIN),$(PY3)))
|
$(eval $(call add_derived_package,$(LIBPY3_MIN),$(PY3)))
|
||||||
$(PY3)_DEPENDS += $(PY3_MIN) $(LIBPY3)
|
$(PY3)_DEPENDS += $(PY3_MIN) $(LIBPY3_STD)
|
||||||
$(PY3)_RDEPENDS += $(PY3_MIN) $(LIBPY3) $(LIBPY3_MIN)
|
$(PY3)_RDEPENDS += $(PY3_MIN) $(LIBPY3_STD)
|
||||||
|
|
||||||
LIBPY3_DEV = lib$(PYTHON_PNAME)-dev_$(PYTHON_VER)_amd64.deb
|
LIBPY3_DEV = lib$(PYTHON_PNAME)-dev_$(PYTHON_VER)_amd64.deb
|
||||||
$(eval $(call add_derived_package,$(LIBPY3_MIN),$(LIBPY3_DEV)))
|
$(eval $(call add_derived_package,$(LIBPY3_MIN),$(LIBPY3_DEV)))
|
||||||
|
Reference in New Issue
Block a user