diff --git a/3.10/alpine3.16/Dockerfile b/3.10/alpine3.16/Dockerfile index be7f497f1..cd02a2e36 100644 --- a/3.10/alpine3.16/Dockerfile +++ b/3.10/alpine3.16/Dockerfile @@ -45,7 +45,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -81,18 +80,25 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - LDFLAGS="-Wl,--strip-all" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ + LDFLAGS="-Wl,--strip-all"; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.10/alpine3.17/Dockerfile b/3.10/alpine3.17/Dockerfile index 2f0730120..0c054928b 100644 --- a/3.10/alpine3.17/Dockerfile +++ b/3.10/alpine3.17/Dockerfile @@ -45,7 +45,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -81,18 +80,25 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - LDFLAGS="-Wl,--strip-all" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ + LDFLAGS="-Wl,--strip-all"; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.10/bullseye/Dockerfile b/3.10/bullseye/Dockerfile index 63e2218a7..d91a65a0d 100644 --- a/3.10/bullseye/Dockerfile +++ b/3.10/bullseye/Dockerfile @@ -27,12 +27,6 @@ ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.10.9 RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - patchelf \ - ; \ \ wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ @@ -59,15 +53,23 @@ RUN set -eux; \ ; \ nproc="$(nproc)"; \ make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -84,11 +86,6 @@ RUN set -eux; \ \ ldconfig; \ \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ python3 --version # make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) diff --git a/3.10/buster/Dockerfile b/3.10/buster/Dockerfile index 7a7901e01..29009a2c8 100644 --- a/3.10/buster/Dockerfile +++ b/3.10/buster/Dockerfile @@ -27,12 +27,6 @@ ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.10.9 RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - patchelf \ - ; \ \ wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ @@ -59,15 +53,23 @@ RUN set -eux; \ ; \ nproc="$(nproc)"; \ make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -84,11 +86,6 @@ RUN set -eux; \ \ ldconfig; \ \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ python3 --version # make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) diff --git a/3.10/slim-bullseye/Dockerfile b/3.10/slim-bullseye/Dockerfile index 54257cead..bf45632cb 100644 --- a/3.10/slim-bullseye/Dockerfile +++ b/3.10/slim-bullseye/Dockerfile @@ -46,7 +46,6 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ @@ -78,15 +77,22 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ + LDFLAGS="-Wl,--strip-all"; \ make -j "$nproc" \ - LDFLAGS="-Wl,--strip-all" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.10/slim-buster/Dockerfile b/3.10/slim-buster/Dockerfile index 99f998a90..96e7670b9 100644 --- a/3.10/slim-buster/Dockerfile +++ b/3.10/slim-buster/Dockerfile @@ -46,7 +46,6 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ @@ -78,15 +77,22 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ + LDFLAGS="-Wl,--strip-all"; \ make -j "$nproc" \ - LDFLAGS="-Wl,--strip-all" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.11/alpine3.16/Dockerfile b/3.11/alpine3.16/Dockerfile index 7e2e60947..57c25da0c 100644 --- a/3.11/alpine3.16/Dockerfile +++ b/3.11/alpine3.16/Dockerfile @@ -45,7 +45,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -81,18 +80,25 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - LDFLAGS="-Wl,--strip-all" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ + LDFLAGS="-Wl,--strip-all"; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.11/alpine3.17/Dockerfile b/3.11/alpine3.17/Dockerfile index f0dede51c..9e499cb75 100644 --- a/3.11/alpine3.17/Dockerfile +++ b/3.11/alpine3.17/Dockerfile @@ -45,7 +45,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -81,18 +80,25 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - LDFLAGS="-Wl,--strip-all" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ + LDFLAGS="-Wl,--strip-all"; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.11/bullseye/Dockerfile b/3.11/bullseye/Dockerfile index fb5f58983..b86b7100e 100644 --- a/3.11/bullseye/Dockerfile +++ b/3.11/bullseye/Dockerfile @@ -27,12 +27,6 @@ ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.11.1 RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - patchelf \ - ; \ \ wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ @@ -59,15 +53,23 @@ RUN set -eux; \ ; \ nproc="$(nproc)"; \ make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -84,11 +86,6 @@ RUN set -eux; \ \ ldconfig; \ \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ python3 --version # make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) diff --git a/3.11/buster/Dockerfile b/3.11/buster/Dockerfile index 1ff15e8b1..e8f06d802 100644 --- a/3.11/buster/Dockerfile +++ b/3.11/buster/Dockerfile @@ -27,12 +27,6 @@ ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.11.1 RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - patchelf \ - ; \ \ wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ @@ -59,15 +53,23 @@ RUN set -eux; \ ; \ nproc="$(nproc)"; \ make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -84,11 +86,6 @@ RUN set -eux; \ \ ldconfig; \ \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ python3 --version # make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) diff --git a/3.11/slim-bullseye/Dockerfile b/3.11/slim-bullseye/Dockerfile index 41ee538f5..e6b0a873c 100644 --- a/3.11/slim-bullseye/Dockerfile +++ b/3.11/slim-bullseye/Dockerfile @@ -46,7 +46,6 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ @@ -78,15 +77,22 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ + LDFLAGS="-Wl,--strip-all"; \ make -j "$nproc" \ - LDFLAGS="-Wl,--strip-all" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.11/slim-buster/Dockerfile b/3.11/slim-buster/Dockerfile index 1ef82dce9..55beb9506 100644 --- a/3.11/slim-buster/Dockerfile +++ b/3.11/slim-buster/Dockerfile @@ -46,7 +46,6 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ @@ -78,15 +77,22 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ + LDFLAGS="-Wl,--strip-all"; \ make -j "$nproc" \ - LDFLAGS="-Wl,--strip-all" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.12-rc/alpine3.16/Dockerfile b/3.12-rc/alpine3.16/Dockerfile index b5660f54e..d2fd23d71 100644 --- a/3.12-rc/alpine3.16/Dockerfile +++ b/3.12-rc/alpine3.16/Dockerfile @@ -45,7 +45,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -81,18 +80,25 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - LDFLAGS="-Wl,--strip-all" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ + LDFLAGS="-Wl,--strip-all"; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.12-rc/alpine3.17/Dockerfile b/3.12-rc/alpine3.17/Dockerfile index 4b118add0..2c1367cd5 100644 --- a/3.12-rc/alpine3.17/Dockerfile +++ b/3.12-rc/alpine3.17/Dockerfile @@ -45,7 +45,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -81,18 +80,25 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - LDFLAGS="-Wl,--strip-all" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ + LDFLAGS="-Wl,--strip-all"; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.12-rc/bullseye/Dockerfile b/3.12-rc/bullseye/Dockerfile index 272e5876e..2d9ea69ac 100644 --- a/3.12-rc/bullseye/Dockerfile +++ b/3.12-rc/bullseye/Dockerfile @@ -27,12 +27,6 @@ ENV GPG_KEY 7169605F62C751356D054A26A821E680E5FA6305 ENV PYTHON_VERSION 3.12.0a4 RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - patchelf \ - ; \ \ wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ @@ -59,15 +53,23 @@ RUN set -eux; \ ; \ nproc="$(nproc)"; \ make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -84,11 +86,6 @@ RUN set -eux; \ \ ldconfig; \ \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ python3 --version # make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) diff --git a/3.12-rc/buster/Dockerfile b/3.12-rc/buster/Dockerfile index 784d7eb42..0ab8091fe 100644 --- a/3.12-rc/buster/Dockerfile +++ b/3.12-rc/buster/Dockerfile @@ -27,12 +27,6 @@ ENV GPG_KEY 7169605F62C751356D054A26A821E680E5FA6305 ENV PYTHON_VERSION 3.12.0a4 RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - patchelf \ - ; \ \ wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ @@ -59,15 +53,23 @@ RUN set -eux; \ ; \ nproc="$(nproc)"; \ make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -84,11 +86,6 @@ RUN set -eux; \ \ ldconfig; \ \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ python3 --version # make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) diff --git a/3.12-rc/slim-bullseye/Dockerfile b/3.12-rc/slim-bullseye/Dockerfile index c5a44c65b..156cdc824 100644 --- a/3.12-rc/slim-bullseye/Dockerfile +++ b/3.12-rc/slim-bullseye/Dockerfile @@ -46,7 +46,6 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ @@ -78,15 +77,22 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ + LDFLAGS="-Wl,--strip-all"; \ make -j "$nproc" \ - LDFLAGS="-Wl,--strip-all" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.12-rc/slim-buster/Dockerfile b/3.12-rc/slim-buster/Dockerfile index 8af4000eb..0fd0a3aca 100644 --- a/3.12-rc/slim-buster/Dockerfile +++ b/3.12-rc/slim-buster/Dockerfile @@ -46,7 +46,6 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ @@ -78,15 +77,22 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ + LDFLAGS="-Wl,--strip-all"; \ make -j "$nproc" \ - LDFLAGS="-Wl,--strip-all" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.7/alpine3.16/Dockerfile b/3.7/alpine3.16/Dockerfile index 21b4fcb5f..9912eacae 100644 --- a/3.7/alpine3.16/Dockerfile +++ b/3.7/alpine3.16/Dockerfile @@ -45,7 +45,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -80,54 +79,61 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - LDFLAGS="-Wl,--strip-all" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ + LDFLAGS="-Wl,--strip-all"; \ # setting PROFILE_TASK makes "--enable-optimizations" reasonable: https://bugs.python.org/issue36044 / https://github.com/docker-library/python/issues/160#issuecomment-509426916 - PROFILE_TASK='-m test.regrtest --pgo \ - test_array \ - test_base64 \ - test_binascii \ - test_binhex \ - test_binop \ - test_bytes \ - test_c_locale_coercion \ - test_class \ - test_cmath \ - test_codecs \ - test_compile \ - test_complex \ - test_csv \ - test_decimal \ - test_dict \ - test_float \ - test_fstring \ - test_hashlib \ - test_io \ - test_iter \ - test_json \ - test_long \ - test_math \ - test_memoryview \ - test_pickle \ - test_re \ - test_set \ - test_slice \ - test_struct \ - test_threading \ - test_time \ - test_traceback \ - test_unicode \ - ' \ + PROFILE_TASK='-m test.regrtest --pgo \ + test_array \ + test_base64 \ + test_binascii \ + test_binhex \ + test_binop \ + test_bytes \ + test_c_locale_coercion \ + test_class \ + test_cmath \ + test_codecs \ + test_compile \ + test_complex \ + test_csv \ + test_decimal \ + test_dict \ + test_float \ + test_fstring \ + test_hashlib \ + test_io \ + test_iter \ + test_json \ + test_long \ + test_math \ + test_memoryview \ + test_pickle \ + test_re \ + test_set \ + test_slice \ + test_struct \ + test_threading \ + test_time \ + test_traceback \ + test_unicode \ + '; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.7/alpine3.17/Dockerfile b/3.7/alpine3.17/Dockerfile index 7eef7870f..613503d65 100644 --- a/3.7/alpine3.17/Dockerfile +++ b/3.7/alpine3.17/Dockerfile @@ -45,7 +45,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -80,54 +79,61 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - LDFLAGS="-Wl,--strip-all" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ + LDFLAGS="-Wl,--strip-all"; \ # setting PROFILE_TASK makes "--enable-optimizations" reasonable: https://bugs.python.org/issue36044 / https://github.com/docker-library/python/issues/160#issuecomment-509426916 - PROFILE_TASK='-m test.regrtest --pgo \ - test_array \ - test_base64 \ - test_binascii \ - test_binhex \ - test_binop \ - test_bytes \ - test_c_locale_coercion \ - test_class \ - test_cmath \ - test_codecs \ - test_compile \ - test_complex \ - test_csv \ - test_decimal \ - test_dict \ - test_float \ - test_fstring \ - test_hashlib \ - test_io \ - test_iter \ - test_json \ - test_long \ - test_math \ - test_memoryview \ - test_pickle \ - test_re \ - test_set \ - test_slice \ - test_struct \ - test_threading \ - test_time \ - test_traceback \ - test_unicode \ - ' \ + PROFILE_TASK='-m test.regrtest --pgo \ + test_array \ + test_base64 \ + test_binascii \ + test_binhex \ + test_binop \ + test_bytes \ + test_c_locale_coercion \ + test_class \ + test_cmath \ + test_codecs \ + test_compile \ + test_complex \ + test_csv \ + test_decimal \ + test_dict \ + test_float \ + test_fstring \ + test_hashlib \ + test_io \ + test_iter \ + test_json \ + test_long \ + test_math \ + test_memoryview \ + test_pickle \ + test_re \ + test_set \ + test_slice \ + test_struct \ + test_threading \ + test_time \ + test_traceback \ + test_unicode \ + '; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.7/bullseye/Dockerfile b/3.7/bullseye/Dockerfile index a711e508c..117e44b3a 100644 --- a/3.7/bullseye/Dockerfile +++ b/3.7/bullseye/Dockerfile @@ -27,12 +27,6 @@ ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D ENV PYTHON_VERSION 3.7.16 RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - patchelf \ - ; \ \ wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ @@ -57,52 +51,60 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # setting PROFILE_TASK makes "--enable-optimizations" reasonable: https://bugs.python.org/issue36044 / https://github.com/docker-library/python/issues/160#issuecomment-509426916 - PROFILE_TASK='-m test.regrtest --pgo \ - test_array \ - test_base64 \ - test_binascii \ - test_binhex \ - test_binop \ - test_bytes \ - test_c_locale_coercion \ - test_class \ - test_cmath \ - test_codecs \ - test_compile \ - test_complex \ - test_csv \ - test_decimal \ - test_dict \ - test_float \ - test_fstring \ - test_hashlib \ - test_io \ - test_iter \ - test_json \ - test_long \ - test_math \ - test_memoryview \ - test_pickle \ - test_re \ - test_set \ - test_slice \ - test_struct \ - test_threading \ - test_time \ - test_traceback \ - test_unicode \ - ' \ + PROFILE_TASK='-m test.regrtest --pgo \ + test_array \ + test_base64 \ + test_binascii \ + test_binhex \ + test_binop \ + test_bytes \ + test_c_locale_coercion \ + test_class \ + test_cmath \ + test_codecs \ + test_compile \ + test_complex \ + test_csv \ + test_decimal \ + test_dict \ + test_float \ + test_fstring \ + test_hashlib \ + test_io \ + test_iter \ + test_json \ + test_long \ + test_math \ + test_memoryview \ + test_pickle \ + test_re \ + test_set \ + test_slice \ + test_struct \ + test_threading \ + test_time \ + test_traceback \ + test_unicode \ + '; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -120,11 +122,6 @@ RUN set -eux; \ \ ldconfig; \ \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ python3 --version # make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) diff --git a/3.7/buster/Dockerfile b/3.7/buster/Dockerfile index ed5d625a9..7c14c2f87 100644 --- a/3.7/buster/Dockerfile +++ b/3.7/buster/Dockerfile @@ -27,12 +27,6 @@ ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D ENV PYTHON_VERSION 3.7.16 RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - patchelf \ - ; \ \ wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ @@ -57,52 +51,60 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # setting PROFILE_TASK makes "--enable-optimizations" reasonable: https://bugs.python.org/issue36044 / https://github.com/docker-library/python/issues/160#issuecomment-509426916 - PROFILE_TASK='-m test.regrtest --pgo \ - test_array \ - test_base64 \ - test_binascii \ - test_binhex \ - test_binop \ - test_bytes \ - test_c_locale_coercion \ - test_class \ - test_cmath \ - test_codecs \ - test_compile \ - test_complex \ - test_csv \ - test_decimal \ - test_dict \ - test_float \ - test_fstring \ - test_hashlib \ - test_io \ - test_iter \ - test_json \ - test_long \ - test_math \ - test_memoryview \ - test_pickle \ - test_re \ - test_set \ - test_slice \ - test_struct \ - test_threading \ - test_time \ - test_traceback \ - test_unicode \ - ' \ + PROFILE_TASK='-m test.regrtest --pgo \ + test_array \ + test_base64 \ + test_binascii \ + test_binhex \ + test_binop \ + test_bytes \ + test_c_locale_coercion \ + test_class \ + test_cmath \ + test_codecs \ + test_compile \ + test_complex \ + test_csv \ + test_decimal \ + test_dict \ + test_float \ + test_fstring \ + test_hashlib \ + test_io \ + test_iter \ + test_json \ + test_long \ + test_math \ + test_memoryview \ + test_pickle \ + test_re \ + test_set \ + test_slice \ + test_struct \ + test_threading \ + test_time \ + test_traceback \ + test_unicode \ + '; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -120,11 +122,6 @@ RUN set -eux; \ \ ldconfig; \ \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ python3 --version # make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) diff --git a/3.7/slim-bullseye/Dockerfile b/3.7/slim-bullseye/Dockerfile index fc027f1c9..2a5064c4a 100644 --- a/3.7/slim-bullseye/Dockerfile +++ b/3.7/slim-bullseye/Dockerfile @@ -46,7 +46,6 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ @@ -77,51 +76,58 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ - LDFLAGS="-Wl,--strip-all" \ + LDFLAGS="-Wl,--strip-all"; \ # setting PROFILE_TASK makes "--enable-optimizations" reasonable: https://bugs.python.org/issue36044 / https://github.com/docker-library/python/issues/160#issuecomment-509426916 - PROFILE_TASK='-m test.regrtest --pgo \ - test_array \ - test_base64 \ - test_binascii \ - test_binhex \ - test_binop \ - test_bytes \ - test_c_locale_coercion \ - test_class \ - test_cmath \ - test_codecs \ - test_compile \ - test_complex \ - test_csv \ - test_decimal \ - test_dict \ - test_float \ - test_fstring \ - test_hashlib \ - test_io \ - test_iter \ - test_json \ - test_long \ - test_math \ - test_memoryview \ - test_pickle \ - test_re \ - test_set \ - test_slice \ - test_struct \ - test_threading \ - test_time \ - test_traceback \ - test_unicode \ - ' \ + PROFILE_TASK='-m test.regrtest --pgo \ + test_array \ + test_base64 \ + test_binascii \ + test_binhex \ + test_binop \ + test_bytes \ + test_c_locale_coercion \ + test_class \ + test_cmath \ + test_codecs \ + test_compile \ + test_complex \ + test_csv \ + test_decimal \ + test_dict \ + test_float \ + test_fstring \ + test_hashlib \ + test_io \ + test_iter \ + test_json \ + test_long \ + test_math \ + test_memoryview \ + test_pickle \ + test_re \ + test_set \ + test_slice \ + test_struct \ + test_threading \ + test_time \ + test_traceback \ + test_unicode \ + '; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.7/slim-buster/Dockerfile b/3.7/slim-buster/Dockerfile index 50af4aa64..2d6aeab90 100644 --- a/3.7/slim-buster/Dockerfile +++ b/3.7/slim-buster/Dockerfile @@ -46,7 +46,6 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ @@ -77,51 +76,58 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ - LDFLAGS="-Wl,--strip-all" \ + LDFLAGS="-Wl,--strip-all"; \ # setting PROFILE_TASK makes "--enable-optimizations" reasonable: https://bugs.python.org/issue36044 / https://github.com/docker-library/python/issues/160#issuecomment-509426916 - PROFILE_TASK='-m test.regrtest --pgo \ - test_array \ - test_base64 \ - test_binascii \ - test_binhex \ - test_binop \ - test_bytes \ - test_c_locale_coercion \ - test_class \ - test_cmath \ - test_codecs \ - test_compile \ - test_complex \ - test_csv \ - test_decimal \ - test_dict \ - test_float \ - test_fstring \ - test_hashlib \ - test_io \ - test_iter \ - test_json \ - test_long \ - test_math \ - test_memoryview \ - test_pickle \ - test_re \ - test_set \ - test_slice \ - test_struct \ - test_threading \ - test_time \ - test_traceback \ - test_unicode \ - ' \ + PROFILE_TASK='-m test.regrtest --pgo \ + test_array \ + test_base64 \ + test_binascii \ + test_binhex \ + test_binop \ + test_bytes \ + test_c_locale_coercion \ + test_class \ + test_cmath \ + test_codecs \ + test_compile \ + test_complex \ + test_csv \ + test_decimal \ + test_dict \ + test_float \ + test_fstring \ + test_hashlib \ + test_io \ + test_iter \ + test_json \ + test_long \ + test_math \ + test_memoryview \ + test_pickle \ + test_re \ + test_set \ + test_slice \ + test_struct \ + test_threading \ + test_time \ + test_traceback \ + test_unicode \ + '; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.8/alpine3.16/Dockerfile b/3.8/alpine3.16/Dockerfile index 7651a5005..f6caca849 100644 --- a/3.8/alpine3.16/Dockerfile +++ b/3.8/alpine3.16/Dockerfile @@ -45,7 +45,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -80,18 +79,25 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - LDFLAGS="-Wl,--strip-all" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ + LDFLAGS="-Wl,--strip-all"; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.8/alpine3.17/Dockerfile b/3.8/alpine3.17/Dockerfile index d083ec87d..f802fb165 100644 --- a/3.8/alpine3.17/Dockerfile +++ b/3.8/alpine3.17/Dockerfile @@ -45,7 +45,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -80,18 +79,25 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - LDFLAGS="-Wl,--strip-all" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ + LDFLAGS="-Wl,--strip-all"; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.8/bullseye/Dockerfile b/3.8/bullseye/Dockerfile index bf40a6801..3f66ac96e 100644 --- a/3.8/bullseye/Dockerfile +++ b/3.8/bullseye/Dockerfile @@ -27,12 +27,6 @@ ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.8.16 RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - patchelf \ - ; \ \ wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ @@ -58,15 +52,23 @@ RUN set -eux; \ ; \ nproc="$(nproc)"; \ make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -84,11 +86,6 @@ RUN set -eux; \ \ ldconfig; \ \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ python3 --version # make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) diff --git a/3.8/buster/Dockerfile b/3.8/buster/Dockerfile index 5f0306b6f..129ac4936 100644 --- a/3.8/buster/Dockerfile +++ b/3.8/buster/Dockerfile @@ -27,12 +27,6 @@ ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.8.16 RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - patchelf \ - ; \ \ wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ @@ -58,15 +52,23 @@ RUN set -eux; \ ; \ nproc="$(nproc)"; \ make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -84,11 +86,6 @@ RUN set -eux; \ \ ldconfig; \ \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ python3 --version # make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) diff --git a/3.8/slim-bullseye/Dockerfile b/3.8/slim-bullseye/Dockerfile index 39daf590f..59b354210 100644 --- a/3.8/slim-bullseye/Dockerfile +++ b/3.8/slim-bullseye/Dockerfile @@ -46,7 +46,6 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ @@ -77,15 +76,22 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ + LDFLAGS="-Wl,--strip-all"; \ make -j "$nproc" \ - LDFLAGS="-Wl,--strip-all" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.8/slim-buster/Dockerfile b/3.8/slim-buster/Dockerfile index 6078ad846..07101bf7f 100644 --- a/3.8/slim-buster/Dockerfile +++ b/3.8/slim-buster/Dockerfile @@ -46,7 +46,6 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ @@ -77,15 +76,22 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ + LDFLAGS="-Wl,--strip-all"; \ make -j "$nproc" \ - LDFLAGS="-Wl,--strip-all" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.9/alpine3.16/Dockerfile b/3.9/alpine3.16/Dockerfile index ca3f157d3..e1db508b8 100644 --- a/3.9/alpine3.16/Dockerfile +++ b/3.9/alpine3.16/Dockerfile @@ -45,7 +45,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -80,18 +79,25 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - LDFLAGS="-Wl,--strip-all" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ + LDFLAGS="-Wl,--strip-all"; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.9/alpine3.17/Dockerfile b/3.9/alpine3.17/Dockerfile index acf19e632..79cd098b2 100644 --- a/3.9/alpine3.17/Dockerfile +++ b/3.9/alpine3.17/Dockerfile @@ -45,7 +45,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -80,18 +79,25 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ - LDFLAGS="-Wl,--strip-all" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ + LDFLAGS="-Wl,--strip-all"; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.9/bullseye/Dockerfile b/3.9/bullseye/Dockerfile index 187c70055..0c1fb42b9 100644 --- a/3.9/bullseye/Dockerfile +++ b/3.9/bullseye/Dockerfile @@ -27,12 +27,6 @@ ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.9.16 RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - patchelf \ - ; \ \ wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ @@ -58,15 +52,23 @@ RUN set -eux; \ ; \ nproc="$(nproc)"; \ make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -83,11 +85,6 @@ RUN set -eux; \ \ ldconfig; \ \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ python3 --version # make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) diff --git a/3.9/buster/Dockerfile b/3.9/buster/Dockerfile index 3e10a2b00..97a7bbc6e 100644 --- a/3.9/buster/Dockerfile +++ b/3.9/buster/Dockerfile @@ -27,12 +27,6 @@ ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.9.16 RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - patchelf \ - ; \ \ wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ @@ -58,15 +52,23 @@ RUN set -eux; \ ; \ nproc="$(nproc)"; \ make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -83,11 +85,6 @@ RUN set -eux; \ \ ldconfig; \ \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ python3 --version # make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) diff --git a/3.9/slim-bullseye/Dockerfile b/3.9/slim-bullseye/Dockerfile index f10075a8e..1df1af730 100644 --- a/3.9/slim-bullseye/Dockerfile +++ b/3.9/slim-bullseye/Dockerfile @@ -46,7 +46,6 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ @@ -77,15 +76,22 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ + LDFLAGS="-Wl,--strip-all"; \ make -j "$nproc" \ - LDFLAGS="-Wl,--strip-all" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/3.9/slim-buster/Dockerfile b/3.9/slim-buster/Dockerfile index f11ba0b06..76ac15109 100644 --- a/3.9/slim-buster/Dockerfile +++ b/3.9/slim-buster/Dockerfile @@ -46,7 +46,6 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ @@ -77,15 +76,22 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ + LDFLAGS="-Wl,--strip-all"; \ make -j "$nproc" \ - LDFLAGS="-Wl,--strip-all" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ \ cd /; \ rm -rf /usr/src/python; \ diff --git a/Dockerfile-linux.template b/Dockerfile-linux.template index 6f29c5c9d..aedfc1aba 100644 --- a/Dockerfile-linux.template +++ b/Dockerfile-linux.template @@ -99,7 +99,6 @@ RUN set -eux; \ make \ ncurses-dev \ openssl-dev \ - patchelf \ pax-utils \ readline-dev \ sqlite-dev \ @@ -111,11 +110,10 @@ RUN set -eux; \ zlib-dev \ ; \ \ -{{ ) else ( -}} +{{ ) elif is_slim then ( -}} savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends \ -{{ if is_slim then ( -}} dpkg-dev \ gcc \ gnupg dirmngr \ @@ -131,18 +129,14 @@ RUN set -eux; \ libsqlite3-dev \ libssl-dev \ make \ - patchelf \ tk-dev \ uuid-dev \ wget \ xz-utils \ zlib1g-dev \ -{{ ) else ( -}} - patchelf \ -{{ ) end -}} ; \ \ -{{ ) end -}} +{{ ) else "" end -}} wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; \ wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; \ GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \ @@ -172,71 +166,79 @@ RUN set -eux; \ --without-ensurepip \ ; \ nproc="$(nproc)"; \ - make -j "$nproc" \ {{ if is_alpine then ( -}} # set thread stack size to 1MB so we don't segfault before we hit sys.getrecursionlimit() # https://github.com/alpinelinux/aports/commit/2026e1259422d4e0cf92391ca2d3844356c649d0 - EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000" \ + EXTRA_CFLAGS="-DTHREAD_STACK_SIZE=0x100000"; \ {{ ) else "" end -}} {{ if is_slim or is_alpine then ( -}} - LDFLAGS="-Wl,--strip-all" \ + LDFLAGS="-Wl,--strip-all"; \ {{ ) else "" end -}} {{ if env.version == "3.7" then ( -}} # setting PROFILE_TASK makes "--enable-optimizations" reasonable: https://bugs.python.org/issue36044 / https://github.com/docker-library/python/issues/160#issuecomment-509426916 - PROFILE_TASK='-m test.regrtest --pgo \ - test_array \ - test_base64 \ - test_binascii \ - test_binhex \ - test_binop \ - test_bytes \ - test_c_locale_coercion \ - test_class \ - test_cmath \ - test_codecs \ - test_compile \ - test_complex \ - test_csv \ - test_decimal \ - test_dict \ - test_float \ - test_fstring \ - test_hashlib \ - test_io \ - test_iter \ - test_json \ - test_long \ - test_math \ - test_memoryview \ - test_pickle \ - test_re \ - test_set \ - test_slice \ - test_struct \ - test_threading \ - test_time \ - test_traceback \ - test_unicode \ - ' \ + PROFILE_TASK='-m test.regrtest --pgo \ + test_array \ + test_base64 \ + test_binascii \ + test_binhex \ + test_binop \ + test_bytes \ + test_c_locale_coercion \ + test_class \ + test_cmath \ + test_codecs \ + test_compile \ + test_complex \ + test_csv \ + test_decimal \ + test_dict \ + test_float \ + test_fstring \ + test_hashlib \ + test_io \ + test_iter \ + test_json \ + test_long \ + test_math \ + test_memoryview \ + test_pickle \ + test_re \ + test_set \ + test_slice \ + test_struct \ + test_threading \ + test_time \ + test_traceback \ + test_unicode \ + '; \ {{ - ) else - # PROFILE_TASK has a reasonable default starting in 3.8+; see: - # https://bugs.python.org/issue36044 - # https://github.com/python/cpython/pull/14702 - # https://github.com/python/cpython/pull/14910 - "" - end +) else + # PROFILE_TASK has a reasonable default starting in 3.8+; see: + # https://bugs.python.org/issue36044 + # https://github.com/python/cpython/pull/14702 + # https://github.com/python/cpython/pull/14910 + "" +end -}} + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:-}" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ ; \ - make install; \ - \ # https://github.com/docker-library/python/issues/784 # prevent accidental usage of a system installed libpython of the same version - bin="$(readlink -vf /usr/local/bin/python3)"; \ - patchelf --set-rpath '$ORIGIN/../lib' "$bin"; \ + rm python; \ + make -j "$nproc" \ + "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" \ + "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" \ + "PROFILE_TASK=${PROFILE_TASK:-}" \ + python \ + ; \ + make install; \ {{ if is_alpine or is_slim then "" else ( -}} \ # enable GDB to load debugging data: https://github.com/docker-library/python/pull/701 + bin="$(readlink -ve /usr/local/bin/python3)"; \ dir="$(dirname "$bin")"; \ mkdir -p "/usr/share/gdb/auto-load/$dir"; \ cp -vL Tools/gdb/libpython.py "/usr/share/gdb/auto-load/$bin-gdb.py"; \ @@ -270,10 +272,10 @@ RUN set -eux; \ apk del --no-network .build-deps; \ {{ ) else ( -}} ldconfig; \ +{{ if is_slim then ( -}} \ apt-mark auto '.*' > /dev/null; \ apt-mark manual $savedAptMark; \ -{{ if is_slim then ( -}} find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ @@ -282,9 +284,9 @@ RUN set -eux; \ | sort -u \ | xargs -r apt-mark manual \ ; \ -{{ ) else "" end -}} apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/*; \ +{{ ) else "" end -}} {{ ) end -}} \ python3 --version