File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,11 @@ COPY --from=py311 /tmp/${PYTHON_VERSION}-run-deps.txt /tmp/${PYTHON_VERSI
2828
2929RUN set -eux; \
3030 apt-get update; \
31- # Purge gdb from base image to remove conflicting Python libs
32- apt-get purge gdb -y --autoremove; \
31+ # Purge system Python binaries and libs
32+ PYTHON_PKGS="$(dpkg-query -W -f='${binary:Package}\n ' \
33+ | awk '/^(python3($|[.:_-])|libpython3($|[.:_-]))/ {print}' \
34+ | sort -u)" ; \
35+ printf '%s\n ' "${PYTHON_PKGS}" | xargs -r apt-get purge --auto-remove -y; \
3336 \
3437 sort -u /tmp/${PYTHON_VERSION}-run-deps.txt \
3538 | awk 'NF && $1 !~ /^#/' \
Original file line number Diff line number Diff line change @@ -63,8 +63,11 @@ COPY --from=py311 /tmp/3.11-run-deps.txt /tmp/3.11-run-deps.txt
6363
6464RUN set -eux; \
6565 apt-get update; \
66- # Purge gdb from base image to remove conflicting Python libs
67- apt-get purge gdb -y --autoremove; \
66+ # Purge system Python binaries and libs
67+ PYTHON_PKGS="$(dpkg-query -W -f='${binary:Package}\n ' \
68+ | awk '/^(python3($|[.:_-])|libpython3($|[.:_-]))/ {print}' \
69+ | sort -u)" ; \
70+ printf '%s\n ' "${PYTHON_PKGS}" | xargs -r apt-get purge --auto-remove -y; \
6871 \
6972 sort -u /tmp/*-run-deps.txt \
7073 | awk 'NF && $1 !~ /^#/' \
You can’t perform that action at this time.
0 commit comments