image: cleanup layers a bit more
mostly Python-related cleanup
This commit is contained in:
parent
283f61e866
commit
c4feaf9f83
@ -211,14 +211,29 @@ RUN pip-env.sh pip list --format freeze \
|
||||
RUN libpython="${PYTHON_SITE_PACKAGES%/*}" ; \
|
||||
rm -rfv \
|
||||
/usr/local/bin/idle* \
|
||||
/usr/local/bin/pydoc* \
|
||||
"${libpython}/ensurepip/_bundled" \
|
||||
"${libpython}/idlelib" \
|
||||
"${libpython}/pydoc.py" \
|
||||
"${libpython}/pydoc_data" \
|
||||
"${libpython}/tkinter" \
|
||||
"${libpython}/turtle.py" \
|
||||
"${libpython}/turtledemo" \
|
||||
; \
|
||||
rm -rfv \
|
||||
"${PYTHON_SITE_PACKAGES}/pkg_resources/tests" \
|
||||
"${PYTHON_SITE_PACKAGES}/setuptools/tests" \
|
||||
"${PYTHON_SITE_PACKAGES}/setuptools/_distutils/tests" \
|
||||
"${PYTHON_SITE_PACKAGES}/setuptools/_vendor/importlib_resources/tests" \
|
||||
; \
|
||||
find "${PYTHON_SITE_PACKAGES}/" -iname '*.exe' -ls -delete ; \
|
||||
python-rm-cache.sh /usr/local
|
||||
|
||||
## adjust pip/certifi
|
||||
RUN certifi_pem="${PYTHON_SITE_PACKAGES}/pip/_vendor/certifi/cacert.pem" ; \
|
||||
rm -f "${certifi_pem}" ; \
|
||||
ln -s /etc/ssl/certs/ca-certificates.crt "${certifi_pem}"
|
||||
|
||||
RUN find /usr/local/sbin/ ! -type d -ls -delete ; \
|
||||
find /run/ -mindepth 1 -ls -delete || : ; \
|
||||
install -d -m 01777 /run/lock
|
||||
|
@ -41,12 +41,19 @@ RUN w=$(mktemp -d) ; : "${w:?}" ; \
|
||||
echo ; \
|
||||
find "${PYTHON_SITE_PACKAGES}/" -type f -name '*.so*' -printf '%p\0' \
|
||||
| sed -zE '/rust/d' \
|
||||
| xargs -0r strip --verbose --strip-debug ; \
|
||||
| xargs -0r strip --verbose --strip-debug --strip-unneeded ; \
|
||||
echo ; \
|
||||
find "${PYTHON_SITE_PACKAGES}/" -type f -name '*.so*' -exec ls -l {} + ; \
|
||||
apt-remove.sh build-essential ; \
|
||||
apt-clean.sh
|
||||
|
||||
## avoid changing already present packages
|
||||
RUN find "${PYTHON_SITE_PACKAGES}/" -mindepth 1 -maxdepth 1 -printf '%P\0' \
|
||||
| sed -zEn \
|
||||
-e '/^((pip|setuptools|wheel)-.+\.dist-info|distutils-precedence\.pth|_distutils_hack|pip|pkg_resources|setuptools|wheel)$/p' \
|
||||
| env -C "${PYTHON_SITE_PACKAGES}" xargs -0r \
|
||||
rm -rf
|
||||
|
||||
## ---
|
||||
|
||||
FROM base AS deps
|
||||
|
Loading…
Reference in New Issue
Block a user