diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..90ec81cf7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +/*/**/Dockerfile linguist-generated +/Dockerfile*.template linguist-language=Dockerfile diff --git a/.github/workflows/verify-templating.yml b/.github/workflows/verify-templating.yml new file mode 100644 index 000000000..7e833f1c7 --- /dev/null +++ b/.github/workflows/verify-templating.yml @@ -0,0 +1,22 @@ +name: Verify Templating + +on: + pull_request: + push: + +defaults: + run: + shell: 'bash -Eeuo pipefail -x {0}' + +jobs: + apply-templates: + name: Check For Uncomitted Changes + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Apply Templates + run: ./apply-templates.sh + - name: Check Git Status + run: | + status="$(git status --short)" + [ -z "$status" ] diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..d548f66de --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.jq-template.awk diff --git a/3.10/alpine3.14/Dockerfile b/3.10/alpine3.14/Dockerfile index 9c594b578..0e5f4136f 100644 --- a/3.10/alpine3.14/Dockerfile +++ b/3.10/alpine3.14/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -16,34 +16,20 @@ ENV LANG C.UTF-8 # runtime dependencies RUN set -eux; \ apk add --no-cache \ -# install ca-certificates so that HTTPS works consistently ca-certificates \ -# and tzdata for PEP 615 (https://www.python.org/dev/peps/pep-0615/) tzdata \ ; -# other runtime dependencies for Python are installed later ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.10.2 -RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps \ +RUN set -eux; \ + \ + apk add --no-cache --virtual .build-deps \ gnupg \ tar \ xz \ - \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && apk add --no-cache --virtual .build-deps \ + \ bluez-dev \ bzip2-dev \ coreutils \ @@ -69,12 +55,22 @@ RUN set -ex \ util-linux-dev \ xz-dev \ zlib-dev \ -# add build deps before removing fetch deps in case there's overlap - && apk del --no-network .fetch-deps \ + ; \ + \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -84,35 +80,43 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + 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" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - | xargs -rt apk add --no-cache --virtual .python-rundeps \ - && apk del --no-network .build-deps \ + | xargs -rt apk add --no-network --virtual .python-rundeps \ + ; \ + apk del --no-network .build-deps; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -122,7 +126,7 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ @@ -140,7 +144,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.10/alpine3.15/Dockerfile b/3.10/alpine3.15/Dockerfile index ffcb48d4a..3df075ac0 100644 --- a/3.10/alpine3.15/Dockerfile +++ b/3.10/alpine3.15/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -16,34 +16,20 @@ ENV LANG C.UTF-8 # runtime dependencies RUN set -eux; \ apk add --no-cache \ -# install ca-certificates so that HTTPS works consistently ca-certificates \ -# and tzdata for PEP 615 (https://www.python.org/dev/peps/pep-0615/) tzdata \ ; -# other runtime dependencies for Python are installed later ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.10.2 -RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps \ +RUN set -eux; \ + \ + apk add --no-cache --virtual .build-deps \ gnupg \ tar \ xz \ - \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && apk add --no-cache --virtual .build-deps \ + \ bluez-dev \ bzip2-dev \ coreutils \ @@ -69,12 +55,22 @@ RUN set -ex \ util-linux-dev \ xz-dev \ zlib-dev \ -# add build deps before removing fetch deps in case there's overlap - && apk del --no-network .fetch-deps \ + ; \ + \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -84,35 +80,43 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + 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" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - | xargs -rt apk add --no-cache --virtual .python-rundeps \ - && apk del --no-network .build-deps \ + | xargs -rt apk add --no-network --virtual .python-rundeps \ + ; \ + apk del --no-network .build-deps; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -122,7 +126,7 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ @@ -140,7 +144,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.10/bullseye/Dockerfile b/3.10/bullseye/Dockerfile index 15f79fda8..3ac33ca8e 100644 --- a/3.10/bullseye/Dockerfile +++ b/3.10/bullseye/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -13,32 +13,35 @@ ENV PATH /usr/local/bin:$PATH # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 -# extra dependencies (over what buildpack-deps already includes) -RUN apt-get update && apt-get install -y --no-install-recommends \ +# runtime dependencies +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libbluetooth-dev \ tk-dev \ uuid-dev \ - && rm -rf /var/lib/apt/lists/* + ; \ + rm -rf /var/lib/apt/lists/* ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.10.2 -RUN set -ex \ +RUN set -eux; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -48,26 +51,34 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ + LDFLAGS="-Wl,--strip-all" \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -77,10 +88,10 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ python get-pip.py \ --disable-pip-version-check \ @@ -95,7 +106,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.10/buster/Dockerfile b/3.10/buster/Dockerfile index 2f495fd87..913a287b4 100644 --- a/3.10/buster/Dockerfile +++ b/3.10/buster/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -13,32 +13,35 @@ ENV PATH /usr/local/bin:$PATH # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 -# extra dependencies (over what buildpack-deps already includes) -RUN apt-get update && apt-get install -y --no-install-recommends \ +# runtime dependencies +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libbluetooth-dev \ tk-dev \ uuid-dev \ - && rm -rf /var/lib/apt/lists/* + ; \ + rm -rf /var/lib/apt/lists/* ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.10.2 -RUN set -ex \ +RUN set -eux; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -48,26 +51,34 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ + LDFLAGS="-Wl,--strip-all" \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -77,10 +88,10 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ python get-pip.py \ --disable-pip-version-check \ @@ -95,7 +106,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.10/bullseye/slim/Dockerfile b/3.10/slim-bullseye/Dockerfile similarity index 57% rename from 3.10/bullseye/slim/Dockerfile rename to 3.10/slim-bullseye/Dockerfile index 4798d3911..7650645a2 100644 --- a/3.10/bullseye/slim/Dockerfile +++ b/3.10/slim-bullseye/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -26,12 +26,14 @@ RUN set -eux; \ ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.10.2 -RUN set -ex \ +RUN set -eux; \ \ - && savedAptMark="$(apt-mark showmanual)" \ - && apt-get update && apt-get install -y --no-install-recommends \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ dpkg-dev \ gcc \ + gnupg dirmngr \ libbluetooth-dev \ libbz2-dev \ libc6-dev \ @@ -49,23 +51,22 @@ RUN set -ex \ wget \ xz-utils \ zlib1g-dev \ -# as of Stretch, "gpg" is no longer included by default - $(command -v gpg > /dev/null || echo 'gnupg dirmngr') \ + ; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -75,39 +76,47 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ LDFLAGS="-Wl,--strip-all" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && apt-mark auto '.*' > /dev/null \ - && apt-mark manual $savedAptMark \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ | sort -u \ | xargs -r apt-mark manual \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -117,17 +126,17 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends wget; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -144,7 +153,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.10/buster/slim/Dockerfile b/3.10/slim-buster/Dockerfile similarity index 57% rename from 3.10/buster/slim/Dockerfile rename to 3.10/slim-buster/Dockerfile index b62bcc7e2..9e389d8e2 100644 --- a/3.10/buster/slim/Dockerfile +++ b/3.10/slim-buster/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -26,12 +26,14 @@ RUN set -eux; \ ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.10.2 -RUN set -ex \ +RUN set -eux; \ \ - && savedAptMark="$(apt-mark showmanual)" \ - && apt-get update && apt-get install -y --no-install-recommends \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ dpkg-dev \ gcc \ + gnupg dirmngr \ libbluetooth-dev \ libbz2-dev \ libc6-dev \ @@ -49,23 +51,22 @@ RUN set -ex \ wget \ xz-utils \ zlib1g-dev \ -# as of Stretch, "gpg" is no longer included by default - $(command -v gpg > /dev/null || echo 'gnupg dirmngr') \ + ; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -75,39 +76,47 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ LDFLAGS="-Wl,--strip-all" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && apt-mark auto '.*' > /dev/null \ - && apt-mark manual $savedAptMark \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ | sort -u \ | xargs -r apt-mark manual \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -117,17 +126,17 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends wget; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -144,7 +153,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.10/windows/windowsservercore-1809/Dockerfile b/3.10/windows/windowsservercore-1809/Dockerfile index 2e814ae29..65f228865 100644 --- a/3.10/windows/windowsservercore-1809/Dockerfile +++ b/3.10/windows/windowsservercore-1809/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -12,9 +12,8 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref ENV PYTHONIOENCODING UTF-8 ENV PYTHON_VERSION 3.10.2 -ENV PYTHON_RELEASE 3.10.2 -RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f ($env:PYTHON_VERSION -replace '[a-z]+[0-9]*$', ''), $env:PYTHON_VERSION); \ Write-Host ('Downloading {0} ...' -f $url); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ diff --git a/3.10/windows/windowsservercore-ltsc2022/Dockerfile b/3.10/windows/windowsservercore-ltsc2022/Dockerfile index e9afdeba7..e9c2ee141 100644 --- a/3.10/windows/windowsservercore-ltsc2022/Dockerfile +++ b/3.10/windows/windowsservercore-ltsc2022/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -12,9 +12,8 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref ENV PYTHONIOENCODING UTF-8 ENV PYTHON_VERSION 3.10.2 -ENV PYTHON_RELEASE 3.10.2 -RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f ($env:PYTHON_VERSION -replace '[a-z]+[0-9]*$', ''), $env:PYTHON_VERSION); \ Write-Host ('Downloading {0} ...' -f $url); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ diff --git a/3.11-rc/alpine3.14/Dockerfile b/3.11-rc/alpine3.14/Dockerfile new file mode 100644 index 000000000..bd2b64b02 --- /dev/null +++ b/3.11-rc/alpine3.14/Dockerfile @@ -0,0 +1,151 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.14 + +# ensure local python is preferred over distribution python +ENV PATH /usr/local/bin:$PATH + +# http://bugs.python.org/issue19846 +# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. +ENV LANG C.UTF-8 + +# runtime dependencies +RUN set -eux; \ + apk add --no-cache \ + ca-certificates \ + tzdata \ + ; + +ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D +ENV PYTHON_VERSION 3.11.0a4 + +RUN set -eux; \ + \ + apk add --no-cache --virtual .build-deps \ + gnupg \ + tar \ + xz \ + \ + bluez-dev \ + bzip2-dev \ + coreutils \ + dpkg-dev dpkg \ + expat-dev \ + findutils \ + gcc \ + gdbm-dev \ + libc-dev \ + libffi-dev \ + libnsl-dev \ + libtirpc-dev \ + linux-headers \ + make \ + ncurses-dev \ + openssl-dev \ + pax-utils \ + readline-dev \ + sqlite-dev \ + tcl-dev \ + tk \ + tk-dev \ + util-linux-dev \ + xz-dev \ + zlib-dev \ + ; \ + \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ + \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ + --build="$gnuArch" \ + --enable-loadable-sqlite-extensions \ + --enable-optimizations \ + --enable-option-checking=fatal \ + --enable-shared \ + --with-lto \ + --with-system-expat \ + --with-system-ffi \ + --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" \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ + -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ + \) -exec rm -rf '{}' + \ + ; \ + \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + | xargs -rt apk add --no-network --virtual .python-rundeps \ + ; \ + apk del --no-network .build-deps; \ + \ + python3 --version + +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 21.2.4 +# https://github.com/docker-library/python/issues/365 +ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 +# https://github.com/pypa/get-pip +ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py +ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 + +RUN set -eux; \ + \ + wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ + \ + python get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + "setuptools==$PYTHON_SETUPTOOLS_VERSION" \ + ; \ + pip --version; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ + -o \ + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ + \) -exec rm -rf '{}' + \ + ; \ + rm -f get-pip.py + +CMD ["python3"] diff --git a/3.11-rc/alpine3.15/Dockerfile b/3.11-rc/alpine3.15/Dockerfile index 46e8f001d..232212acc 100644 --- a/3.11-rc/alpine3.15/Dockerfile +++ b/3.11-rc/alpine3.15/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -16,34 +16,20 @@ ENV LANG C.UTF-8 # runtime dependencies RUN set -eux; \ apk add --no-cache \ -# install ca-certificates so that HTTPS works consistently ca-certificates \ -# and tzdata for PEP 615 (https://www.python.org/dev/peps/pep-0615/) tzdata \ ; -# other runtime dependencies for Python are installed later ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.11.0a4 -RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps \ +RUN set -eux; \ + \ + apk add --no-cache --virtual .build-deps \ gnupg \ tar \ xz \ - \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && apk add --no-cache --virtual .build-deps \ + \ bluez-dev \ bzip2-dev \ coreutils \ @@ -69,12 +55,22 @@ RUN set -ex \ util-linux-dev \ xz-dev \ zlib-dev \ -# add build deps before removing fetch deps in case there's overlap - && apk del --no-network .fetch-deps \ + ; \ + \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -84,35 +80,43 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + 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" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - | xargs -rt apk add --no-cache --virtual .python-rundeps \ - && apk del --no-network .build-deps \ + | xargs -rt apk add --no-network --virtual .python-rundeps \ + ; \ + apk del --no-network .build-deps; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -122,7 +126,7 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ @@ -140,7 +144,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.11-rc/bullseye/Dockerfile b/3.11-rc/bullseye/Dockerfile index 5ec4d3436..39a0c9f5f 100644 --- a/3.11-rc/bullseye/Dockerfile +++ b/3.11-rc/bullseye/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -13,32 +13,35 @@ ENV PATH /usr/local/bin:$PATH # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 -# extra dependencies (over what buildpack-deps already includes) -RUN apt-get update && apt-get install -y --no-install-recommends \ +# runtime dependencies +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libbluetooth-dev \ tk-dev \ uuid-dev \ - && rm -rf /var/lib/apt/lists/* + ; \ + rm -rf /var/lib/apt/lists/* ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.11.0a4 -RUN set -ex \ +RUN set -eux; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -48,26 +51,34 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ + LDFLAGS="-Wl,--strip-all" \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -77,10 +88,10 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ python get-pip.py \ --disable-pip-version-check \ @@ -95,7 +106,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.11-rc/buster/Dockerfile b/3.11-rc/buster/Dockerfile new file mode 100644 index 000000000..838fcf960 --- /dev/null +++ b/3.11-rc/buster/Dockerfile @@ -0,0 +1,113 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM buildpack-deps:buster + +# ensure local python is preferred over distribution python +ENV PATH /usr/local/bin:$PATH + +# http://bugs.python.org/issue19846 +# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. +ENV LANG C.UTF-8 + +# runtime dependencies +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libbluetooth-dev \ + tk-dev \ + uuid-dev \ + ; \ + rm -rf /var/lib/apt/lists/* + +ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D +ENV PYTHON_VERSION 3.11.0a4 + +RUN set -eux; \ + \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ + \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ + --build="$gnuArch" \ + --enable-loadable-sqlite-extensions \ + --enable-optimizations \ + --enable-option-checking=fatal \ + --enable-shared \ + --with-lto \ + --with-system-expat \ + --with-system-ffi \ + --without-ensurepip \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ + LDFLAGS="-Wl,--strip-all" \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ + -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ + \) -exec rm -rf '{}' + \ + ; \ + \ + ldconfig; \ + \ + python3 --version + +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 21.2.4 +# https://github.com/docker-library/python/issues/365 +ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 +# https://github.com/pypa/get-pip +ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py +ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 + +RUN set -eux; \ + \ + wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ + \ + python get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + "setuptools==$PYTHON_SETUPTOOLS_VERSION" \ + ; \ + pip --version; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ + -o \ + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ + \) -exec rm -rf '{}' + \ + ; \ + rm -f get-pip.py + +CMD ["python3"] diff --git a/3.11-rc/bullseye/slim/Dockerfile b/3.11-rc/slim-bullseye/Dockerfile similarity index 57% rename from 3.11-rc/bullseye/slim/Dockerfile rename to 3.11-rc/slim-bullseye/Dockerfile index dc92a9ac5..0f3847282 100644 --- a/3.11-rc/bullseye/slim/Dockerfile +++ b/3.11-rc/slim-bullseye/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -26,12 +26,14 @@ RUN set -eux; \ ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D ENV PYTHON_VERSION 3.11.0a4 -RUN set -ex \ +RUN set -eux; \ \ - && savedAptMark="$(apt-mark showmanual)" \ - && apt-get update && apt-get install -y --no-install-recommends \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ dpkg-dev \ gcc \ + gnupg dirmngr \ libbluetooth-dev \ libbz2-dev \ libc6-dev \ @@ -49,23 +51,22 @@ RUN set -ex \ wget \ xz-utils \ zlib1g-dev \ -# as of Stretch, "gpg" is no longer included by default - $(command -v gpg > /dev/null || echo 'gnupg dirmngr') \ + ; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -75,39 +76,47 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ LDFLAGS="-Wl,--strip-all" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && apt-mark auto '.*' > /dev/null \ - && apt-mark manual $savedAptMark \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ | sort -u \ | xargs -r apt-mark manual \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -117,17 +126,17 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends wget; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -144,7 +153,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.11-rc/slim-buster/Dockerfile b/3.11-rc/slim-buster/Dockerfile new file mode 100644 index 000000000..f12570d3f --- /dev/null +++ b/3.11-rc/slim-buster/Dockerfile @@ -0,0 +1,160 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:buster-slim + +# ensure local python is preferred over distribution python +ENV PATH /usr/local/bin:$PATH + +# http://bugs.python.org/issue19846 +# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. +ENV LANG C.UTF-8 + +# runtime dependencies +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + netbase \ + tzdata \ + ; \ + rm -rf /var/lib/apt/lists/* + +ENV GPG_KEY A035C8C19219BA821ECEA86B64E628F8D684696D +ENV PYTHON_VERSION 3.11.0a4 + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + dpkg-dev \ + gcc \ + gnupg dirmngr \ + libbluetooth-dev \ + libbz2-dev \ + libc6-dev \ + libexpat1-dev \ + libffi-dev \ + libgdbm-dev \ + liblzma-dev \ + libncursesw5-dev \ + libreadline-dev \ + libsqlite3-dev \ + libssl-dev \ + make \ + tk-dev \ + uuid-dev \ + wget \ + xz-utils \ + zlib1g-dev \ + ; \ + \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ + \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ + --build="$gnuArch" \ + --enable-loadable-sqlite-extensions \ + --enable-optimizations \ + --enable-option-checking=fatal \ + --enable-shared \ + --with-lto \ + --with-system-expat \ + --with-system-ffi \ + --without-ensurepip \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ + LDFLAGS="-Wl,--strip-all" \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ + -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ + \) -exec rm -rf '{}' + \ + ; \ + \ + ldconfig; \ + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + 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) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 21.2.4 +# https://github.com/docker-library/python/issues/365 +ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 +# https://github.com/pypa/get-pip +ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py +ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 + +RUN set -eux; \ + \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends wget; \ + \ + wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ + \ + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ + \ + python get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + "setuptools==$PYTHON_SETUPTOOLS_VERSION" \ + ; \ + pip --version; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ + -o \ + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ + \) -exec rm -rf '{}' + \ + ; \ + rm -f get-pip.py + +CMD ["python3"] diff --git a/3.11-rc/windows/windowsservercore-1809/Dockerfile b/3.11-rc/windows/windowsservercore-1809/Dockerfile index 602c2c84e..b9c6acbf7 100644 --- a/3.11-rc/windows/windowsservercore-1809/Dockerfile +++ b/3.11-rc/windows/windowsservercore-1809/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -12,9 +12,8 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref ENV PYTHONIOENCODING UTF-8 ENV PYTHON_VERSION 3.11.0a4 -ENV PYTHON_RELEASE 3.11.0 -RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f ($env:PYTHON_VERSION -replace '[a-z]+[0-9]*$', ''), $env:PYTHON_VERSION); \ Write-Host ('Downloading {0} ...' -f $url); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ diff --git a/3.11-rc/windows/windowsservercore-ltsc2022/Dockerfile b/3.11-rc/windows/windowsservercore-ltsc2022/Dockerfile index b0c7ffac0..6d86132d5 100644 --- a/3.11-rc/windows/windowsservercore-ltsc2022/Dockerfile +++ b/3.11-rc/windows/windowsservercore-ltsc2022/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -12,9 +12,8 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref ENV PYTHONIOENCODING UTF-8 ENV PYTHON_VERSION 3.11.0a4 -ENV PYTHON_RELEASE 3.11.0 -RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f ($env:PYTHON_VERSION -replace '[a-z]+[0-9]*$', ''), $env:PYTHON_VERSION); \ Write-Host ('Downloading {0} ...' -f $url); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ diff --git a/3.7/alpine3.14/Dockerfile b/3.7/alpine3.14/Dockerfile index 51cc3dee6..f8601d94f 100644 --- a/3.7/alpine3.14/Dockerfile +++ b/3.7/alpine3.14/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -16,32 +16,20 @@ ENV LANG C.UTF-8 # runtime dependencies RUN set -eux; \ apk add --no-cache \ -# install ca-certificates so that HTTPS works consistently ca-certificates \ + tzdata \ ; -# other runtime dependencies for Python are installed later ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D ENV PYTHON_VERSION 3.7.12 -RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps \ +RUN set -eux; \ + \ + apk add --no-cache --virtual .build-deps \ gnupg \ tar \ xz \ - \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && apk add --no-cache --virtual .build-deps \ + \ bluez-dev \ bzip2-dev \ coreutils \ @@ -67,12 +55,22 @@ RUN set -ex \ util-linux-dev \ xz-dev \ zlib-dev \ -# add build deps before removing fetch deps in case there's overlap - && apk del --no-network .fetch-deps \ + ; \ + \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -81,7 +79,9 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + 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" \ @@ -122,31 +122,37 @@ RUN set -ex \ test_traceback \ test_unicode \ ' \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ -o \( -type f -a -name 'wininst-*.exe' \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - | xargs -rt apk add --no-cache --virtual .python-rundeps \ - && apk del --no-network .build-deps \ + | xargs -rt apk add --no-network --virtual .python-rundeps \ + ; \ + apk del --no-network .build-deps; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -156,7 +162,7 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ @@ -174,7 +180,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.7/alpine3.15/Dockerfile b/3.7/alpine3.15/Dockerfile index 69f101038..c3ddbe642 100644 --- a/3.7/alpine3.15/Dockerfile +++ b/3.7/alpine3.15/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -16,32 +16,20 @@ ENV LANG C.UTF-8 # runtime dependencies RUN set -eux; \ apk add --no-cache \ -# install ca-certificates so that HTTPS works consistently ca-certificates \ + tzdata \ ; -# other runtime dependencies for Python are installed later ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D ENV PYTHON_VERSION 3.7.12 -RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps \ +RUN set -eux; \ + \ + apk add --no-cache --virtual .build-deps \ gnupg \ tar \ xz \ - \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && apk add --no-cache --virtual .build-deps \ + \ bluez-dev \ bzip2-dev \ coreutils \ @@ -67,12 +55,22 @@ RUN set -ex \ util-linux-dev \ xz-dev \ zlib-dev \ -# add build deps before removing fetch deps in case there's overlap - && apk del --no-network .fetch-deps \ + ; \ + \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -81,7 +79,9 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + 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" \ @@ -122,31 +122,37 @@ RUN set -ex \ test_traceback \ test_unicode \ ' \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ -o \( -type f -a -name 'wininst-*.exe' \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - | xargs -rt apk add --no-cache --virtual .python-rundeps \ - && apk del --no-network .build-deps \ + | xargs -rt apk add --no-network --virtual .python-rundeps \ + ; \ + apk del --no-network .build-deps; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -156,7 +162,7 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ @@ -174,7 +180,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.7/bullseye/Dockerfile b/3.7/bullseye/Dockerfile index f3ee47d39..7e28ea40b 100644 --- a/3.7/bullseye/Dockerfile +++ b/3.7/bullseye/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -13,32 +13,35 @@ ENV PATH /usr/local/bin:$PATH # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 -# extra dependencies (over what buildpack-deps already includes) -RUN apt-get update && apt-get install -y --no-install-recommends \ +# runtime dependencies +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libbluetooth-dev \ tk-dev \ uuid-dev \ - && rm -rf /var/lib/apt/lists/* + ; \ + rm -rf /var/lib/apt/lists/* ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D ENV PYTHON_VERSION 3.7.12 -RUN set -ex \ +RUN set -eux; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -47,7 +50,10 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ + 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 \ @@ -84,26 +90,31 @@ RUN set -ex \ test_traceback \ test_unicode \ ' \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ -o \( -type f -a -name 'wininst-*.exe' \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -113,10 +124,10 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ python get-pip.py \ --disable-pip-version-check \ @@ -131,7 +142,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.7/buster/Dockerfile b/3.7/buster/Dockerfile index b5c08cb01..a59909326 100644 --- a/3.7/buster/Dockerfile +++ b/3.7/buster/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -13,32 +13,35 @@ ENV PATH /usr/local/bin:$PATH # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 -# extra dependencies (over what buildpack-deps already includes) -RUN apt-get update && apt-get install -y --no-install-recommends \ +# runtime dependencies +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libbluetooth-dev \ tk-dev \ uuid-dev \ - && rm -rf /var/lib/apt/lists/* + ; \ + rm -rf /var/lib/apt/lists/* ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D ENV PYTHON_VERSION 3.7.12 -RUN set -ex \ +RUN set -eux; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -47,7 +50,10 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ + 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 \ @@ -84,26 +90,31 @@ RUN set -ex \ test_traceback \ test_unicode \ ' \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ -o \( -type f -a -name 'wininst-*.exe' \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -113,10 +124,10 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ python get-pip.py \ --disable-pip-version-check \ @@ -131,7 +142,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.7/bullseye/slim/Dockerfile b/3.7/slim-bullseye/Dockerfile similarity index 63% rename from 3.7/bullseye/slim/Dockerfile rename to 3.7/slim-bullseye/Dockerfile index 278027584..a74881230 100644 --- a/3.7/bullseye/slim/Dockerfile +++ b/3.7/slim-bullseye/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -19,18 +19,21 @@ RUN set -eux; \ apt-get install -y --no-install-recommends \ ca-certificates \ netbase \ + tzdata \ ; \ rm -rf /var/lib/apt/lists/* ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D ENV PYTHON_VERSION 3.7.12 -RUN set -ex \ +RUN set -eux; \ \ - && savedAptMark="$(apt-mark showmanual)" \ - && apt-get update && apt-get install -y --no-install-recommends \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ dpkg-dev \ gcc \ + gnupg dirmngr \ libbluetooth-dev \ libbz2-dev \ libc6-dev \ @@ -48,23 +51,22 @@ RUN set -ex \ wget \ xz-utils \ zlib1g-dev \ -# as of Stretch, "gpg" is no longer included by default - $(command -v gpg > /dev/null || echo 'gnupg dirmngr') \ + ; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -73,7 +75,9 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ 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 \ @@ -111,38 +115,44 @@ RUN set -ex \ test_traceback \ test_unicode \ ' \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ -o \( -type f -a -name 'wininst-*.exe' \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && apt-mark auto '.*' > /dev/null \ - && apt-mark manual $savedAptMark \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ | sort -u \ | xargs -r apt-mark manual \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -152,17 +162,17 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends wget; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -179,7 +189,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.7/buster/slim/Dockerfile b/3.7/slim-buster/Dockerfile similarity index 63% rename from 3.7/buster/slim/Dockerfile rename to 3.7/slim-buster/Dockerfile index 85c4e4c34..d1f2ae185 100644 --- a/3.7/buster/slim/Dockerfile +++ b/3.7/slim-buster/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -19,18 +19,21 @@ RUN set -eux; \ apt-get install -y --no-install-recommends \ ca-certificates \ netbase \ + tzdata \ ; \ rm -rf /var/lib/apt/lists/* ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D ENV PYTHON_VERSION 3.7.12 -RUN set -ex \ +RUN set -eux; \ \ - && savedAptMark="$(apt-mark showmanual)" \ - && apt-get update && apt-get install -y --no-install-recommends \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ dpkg-dev \ gcc \ + gnupg dirmngr \ libbluetooth-dev \ libbz2-dev \ libc6-dev \ @@ -48,23 +51,22 @@ RUN set -ex \ wget \ xz-utils \ zlib1g-dev \ -# as of Stretch, "gpg" is no longer included by default - $(command -v gpg > /dev/null || echo 'gnupg dirmngr') \ + ; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -73,7 +75,9 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ 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 \ @@ -111,38 +115,44 @@ RUN set -ex \ test_traceback \ test_unicode \ ' \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ -o \( -type f -a -name 'wininst-*.exe' \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && apt-mark auto '.*' > /dev/null \ - && apt-mark manual $savedAptMark \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ | sort -u \ | xargs -r apt-mark manual \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -152,17 +162,17 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends wget; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -179,7 +189,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.8/alpine3.14/Dockerfile b/3.8/alpine3.14/Dockerfile index 835f0488b..5175b72ea 100644 --- a/3.8/alpine3.14/Dockerfile +++ b/3.8/alpine3.14/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -16,32 +16,20 @@ ENV LANG C.UTF-8 # runtime dependencies RUN set -eux; \ apk add --no-cache \ -# install ca-certificates so that HTTPS works consistently ca-certificates \ + tzdata \ ; -# other runtime dependencies for Python are installed later ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.8.12 -RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps \ +RUN set -eux; \ + \ + apk add --no-cache --virtual .build-deps \ gnupg \ tar \ xz \ - \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && apk add --no-cache --virtual .build-deps \ + \ bluez-dev \ bzip2-dev \ coreutils \ @@ -67,12 +55,22 @@ RUN set -ex \ util-linux-dev \ xz-dev \ zlib-dev \ -# add build deps before removing fetch deps in case there's overlap - && apk del --no-network .fetch-deps \ + ; \ + \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -81,36 +79,44 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + 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" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ -o \( -type f -a -name 'wininst-*.exe' \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - | xargs -rt apk add --no-cache --virtual .python-rundeps \ - && apk del --no-network .build-deps \ + | xargs -rt apk add --no-network --virtual .python-rundeps \ + ; \ + apk del --no-network .build-deps; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -120,7 +126,7 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ @@ -138,7 +144,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.8/alpine3.15/Dockerfile b/3.8/alpine3.15/Dockerfile index 33fa0d082..78063a84a 100644 --- a/3.8/alpine3.15/Dockerfile +++ b/3.8/alpine3.15/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -16,32 +16,20 @@ ENV LANG C.UTF-8 # runtime dependencies RUN set -eux; \ apk add --no-cache \ -# install ca-certificates so that HTTPS works consistently ca-certificates \ + tzdata \ ; -# other runtime dependencies for Python are installed later ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.8.12 -RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps \ +RUN set -eux; \ + \ + apk add --no-cache --virtual .build-deps \ gnupg \ tar \ xz \ - \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && apk add --no-cache --virtual .build-deps \ + \ bluez-dev \ bzip2-dev \ coreutils \ @@ -67,12 +55,22 @@ RUN set -ex \ util-linux-dev \ xz-dev \ zlib-dev \ -# add build deps before removing fetch deps in case there's overlap - && apk del --no-network .fetch-deps \ + ; \ + \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -81,36 +79,44 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + 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" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ -o \( -type f -a -name 'wininst-*.exe' \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - | xargs -rt apk add --no-cache --virtual .python-rundeps \ - && apk del --no-network .build-deps \ + | xargs -rt apk add --no-network --virtual .python-rundeps \ + ; \ + apk del --no-network .build-deps; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -120,7 +126,7 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ @@ -138,7 +144,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.8/bullseye/Dockerfile b/3.8/bullseye/Dockerfile index 3d29f2770..fea5aba6f 100644 --- a/3.8/bullseye/Dockerfile +++ b/3.8/bullseye/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -13,32 +13,35 @@ ENV PATH /usr/local/bin:$PATH # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 -# extra dependencies (over what buildpack-deps already includes) -RUN apt-get update && apt-get install -y --no-install-recommends \ +# runtime dependencies +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libbluetooth-dev \ tk-dev \ uuid-dev \ - && rm -rf /var/lib/apt/lists/* + ; \ + rm -rf /var/lib/apt/lists/* ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.8.12 -RUN set -ex \ +RUN set -eux; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -47,27 +50,35 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ + LDFLAGS="-Wl,--strip-all" \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ -o \( -type f -a -name 'wininst-*.exe' \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -77,10 +88,10 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ python get-pip.py \ --disable-pip-version-check \ @@ -95,7 +106,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.8/buster/Dockerfile b/3.8/buster/Dockerfile index 4c8317a11..3a821eb5d 100644 --- a/3.8/buster/Dockerfile +++ b/3.8/buster/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -13,32 +13,35 @@ ENV PATH /usr/local/bin:$PATH # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 -# extra dependencies (over what buildpack-deps already includes) -RUN apt-get update && apt-get install -y --no-install-recommends \ +# runtime dependencies +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libbluetooth-dev \ tk-dev \ uuid-dev \ - && rm -rf /var/lib/apt/lists/* + ; \ + rm -rf /var/lib/apt/lists/* ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.8.12 -RUN set -ex \ +RUN set -eux; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -47,27 +50,35 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ + LDFLAGS="-Wl,--strip-all" \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ -o \( -type f -a -name 'wininst-*.exe' \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -77,10 +88,10 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ python get-pip.py \ --disable-pip-version-check \ @@ -95,7 +106,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.8/bullseye/slim/Dockerfile b/3.8/slim-bullseye/Dockerfile similarity index 57% rename from 3.8/bullseye/slim/Dockerfile rename to 3.8/slim-bullseye/Dockerfile index d5f3d0765..c49399bcf 100644 --- a/3.8/bullseye/slim/Dockerfile +++ b/3.8/slim-bullseye/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -19,18 +19,21 @@ RUN set -eux; \ apt-get install -y --no-install-recommends \ ca-certificates \ netbase \ + tzdata \ ; \ rm -rf /var/lib/apt/lists/* ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.8.12 -RUN set -ex \ +RUN set -eux; \ \ - && savedAptMark="$(apt-mark showmanual)" \ - && apt-get update && apt-get install -y --no-install-recommends \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ dpkg-dev \ gcc \ + gnupg dirmngr \ libbluetooth-dev \ libbz2-dev \ libc6-dev \ @@ -48,23 +51,22 @@ RUN set -ex \ wget \ xz-utils \ zlib1g-dev \ -# as of Stretch, "gpg" is no longer included by default - $(command -v gpg > /dev/null || echo 'gnupg dirmngr') \ + ; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -73,40 +75,48 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ LDFLAGS="-Wl,--strip-all" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ -o \( -type f -a -name 'wininst-*.exe' \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && apt-mark auto '.*' > /dev/null \ - && apt-mark manual $savedAptMark \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ | sort -u \ | xargs -r apt-mark manual \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -116,17 +126,17 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends wget; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -143,7 +153,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.8/buster/slim/Dockerfile b/3.8/slim-buster/Dockerfile similarity index 57% rename from 3.8/buster/slim/Dockerfile rename to 3.8/slim-buster/Dockerfile index 66b42028f..86e7e1ea2 100644 --- a/3.8/buster/slim/Dockerfile +++ b/3.8/slim-buster/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -19,18 +19,21 @@ RUN set -eux; \ apt-get install -y --no-install-recommends \ ca-certificates \ netbase \ + tzdata \ ; \ rm -rf /var/lib/apt/lists/* ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.8.12 -RUN set -ex \ +RUN set -eux; \ \ - && savedAptMark="$(apt-mark showmanual)" \ - && apt-get update && apt-get install -y --no-install-recommends \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ dpkg-dev \ gcc \ + gnupg dirmngr \ libbluetooth-dev \ libbz2-dev \ libc6-dev \ @@ -48,23 +51,22 @@ RUN set -ex \ wget \ xz-utils \ zlib1g-dev \ -# as of Stretch, "gpg" is no longer included by default - $(command -v gpg > /dev/null || echo 'gnupg dirmngr') \ + ; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -73,40 +75,48 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ LDFLAGS="-Wl,--strip-all" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ -o \( -type f -a -name 'wininst-*.exe' \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && apt-mark auto '.*' > /dev/null \ - && apt-mark manual $savedAptMark \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ | sort -u \ | xargs -r apt-mark manual \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -116,17 +126,17 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends wget; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -143,7 +153,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.9/alpine3.14/Dockerfile b/3.9/alpine3.14/Dockerfile index 1edcf98d6..32e3f2240 100644 --- a/3.9/alpine3.14/Dockerfile +++ b/3.9/alpine3.14/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -16,34 +16,20 @@ ENV LANG C.UTF-8 # runtime dependencies RUN set -eux; \ apk add --no-cache \ -# install ca-certificates so that HTTPS works consistently ca-certificates \ -# and tzdata for PEP 615 (https://www.python.org/dev/peps/pep-0615/) tzdata \ ; -# other runtime dependencies for Python are installed later ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.9.10 -RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps \ +RUN set -eux; \ + \ + apk add --no-cache --virtual .build-deps \ gnupg \ tar \ xz \ - \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && apk add --no-cache --virtual .build-deps \ + \ bluez-dev \ bzip2-dev \ coreutils \ @@ -69,12 +55,22 @@ RUN set -ex \ util-linux-dev \ xz-dev \ zlib-dev \ -# add build deps before removing fetch deps in case there's overlap - && apk del --no-network .fetch-deps \ + ; \ + \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -83,35 +79,43 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + 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" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - | xargs -rt apk add --no-cache --virtual .python-rundeps \ - && apk del --no-network .build-deps \ + | xargs -rt apk add --no-network --virtual .python-rundeps \ + ; \ + apk del --no-network .build-deps; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -121,7 +125,7 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ @@ -139,7 +143,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.9/alpine3.15/Dockerfile b/3.9/alpine3.15/Dockerfile index bd78d430b..0d09e03ae 100644 --- a/3.9/alpine3.15/Dockerfile +++ b/3.9/alpine3.15/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -16,34 +16,20 @@ ENV LANG C.UTF-8 # runtime dependencies RUN set -eux; \ apk add --no-cache \ -# install ca-certificates so that HTTPS works consistently ca-certificates \ -# and tzdata for PEP 615 (https://www.python.org/dev/peps/pep-0615/) tzdata \ ; -# other runtime dependencies for Python are installed later ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.9.10 -RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps \ +RUN set -eux; \ + \ + apk add --no-cache --virtual .build-deps \ gnupg \ tar \ xz \ - \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && apk add --no-cache --virtual .build-deps \ + \ bluez-dev \ bzip2-dev \ coreutils \ @@ -69,12 +55,22 @@ RUN set -ex \ util-linux-dev \ xz-dev \ zlib-dev \ -# add build deps before removing fetch deps in case there's overlap - && apk del --no-network .fetch-deps \ + ; \ + \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -83,35 +79,43 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + 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" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ | tr ',' '\n' \ | sort -u \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - | xargs -rt apk add --no-cache --virtual .python-rundeps \ - && apk del --no-network .build-deps \ + | xargs -rt apk add --no-network --virtual .python-rundeps \ + ; \ + apk del --no-network .build-deps; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -121,7 +125,7 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ @@ -139,7 +143,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.9/bullseye/Dockerfile b/3.9/bullseye/Dockerfile index 6c6ce180d..2a32a3c61 100644 --- a/3.9/bullseye/Dockerfile +++ b/3.9/bullseye/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -13,32 +13,35 @@ ENV PATH /usr/local/bin:$PATH # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 -# extra dependencies (over what buildpack-deps already includes) -RUN apt-get update && apt-get install -y --no-install-recommends \ +# runtime dependencies +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libbluetooth-dev \ tk-dev \ uuid-dev \ - && rm -rf /var/lib/apt/lists/* + ; \ + rm -rf /var/lib/apt/lists/* ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.9.10 -RUN set -ex \ +RUN set -eux; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -47,26 +50,34 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ + LDFLAGS="-Wl,--strip-all" \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -76,10 +87,10 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ python get-pip.py \ --disable-pip-version-check \ @@ -94,7 +105,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.9/buster/Dockerfile b/3.9/buster/Dockerfile index 753765752..51a1187d4 100644 --- a/3.9/buster/Dockerfile +++ b/3.9/buster/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -13,32 +13,35 @@ ENV PATH /usr/local/bin:$PATH # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 -# extra dependencies (over what buildpack-deps already includes) -RUN apt-get update && apt-get install -y --no-install-recommends \ +# runtime dependencies +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ libbluetooth-dev \ tk-dev \ uuid-dev \ - && rm -rf /var/lib/apt/lists/* + ; \ + rm -rf /var/lib/apt/lists/* ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.9.10 -RUN set -ex \ +RUN set -eux; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -47,26 +50,34 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ + LDFLAGS="-Wl,--strip-all" \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -76,10 +87,10 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ python get-pip.py \ --disable-pip-version-check \ @@ -94,7 +105,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.9/bullseye/slim/Dockerfile b/3.9/slim-bullseye/Dockerfile similarity index 57% rename from 3.9/bullseye/slim/Dockerfile rename to 3.9/slim-bullseye/Dockerfile index 1ec027141..af3b3e104 100644 --- a/3.9/bullseye/slim/Dockerfile +++ b/3.9/slim-bullseye/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -26,12 +26,14 @@ RUN set -eux; \ ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.9.10 -RUN set -ex \ +RUN set -eux; \ \ - && savedAptMark="$(apt-mark showmanual)" \ - && apt-get update && apt-get install -y --no-install-recommends \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ dpkg-dev \ gcc \ + gnupg dirmngr \ libbluetooth-dev \ libbz2-dev \ libc6-dev \ @@ -49,23 +51,22 @@ RUN set -ex \ wget \ xz-utils \ zlib1g-dev \ -# as of Stretch, "gpg" is no longer included by default - $(command -v gpg > /dev/null || echo 'gnupg dirmngr') \ + ; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -74,39 +75,47 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ LDFLAGS="-Wl,--strip-all" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && apt-mark auto '.*' > /dev/null \ - && apt-mark manual $savedAptMark \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ | sort -u \ | xargs -r apt-mark manual \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -116,17 +125,17 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends wget; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -143,7 +152,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.9/buster/slim/Dockerfile b/3.9/slim-buster/Dockerfile similarity index 57% rename from 3.9/buster/slim/Dockerfile rename to 3.9/slim-buster/Dockerfile index f0c4f0913..5a84c066e 100644 --- a/3.9/buster/slim/Dockerfile +++ b/3.9/slim-buster/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -26,12 +26,14 @@ RUN set -eux; \ ENV GPG_KEY E3FF2839C048B25C084DEBE9B26995E310250568 ENV PYTHON_VERSION 3.9.10 -RUN set -ex \ +RUN set -eux; \ \ - && savedAptMark="$(apt-mark showmanual)" \ - && apt-get update && apt-get install -y --no-install-recommends \ + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ dpkg-dev \ gcc \ + gnupg dirmngr \ libbluetooth-dev \ libbz2-dev \ libc6-dev \ @@ -49,23 +51,22 @@ RUN set -ex \ wget \ xz-utils \ zlib1g-dev \ -# as of Stretch, "gpg" is no longer included by default - $(command -v gpg > /dev/null || echo 'gnupg dirmngr') \ + ; \ \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ + 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ --build="$gnuArch" \ --enable-loadable-sqlite-extensions \ --enable-optimizations \ @@ -74,39 +75,47 @@ RUN set -ex \ --with-system-expat \ --with-system-ffi \ --without-ensurepip \ - && make -j "$(nproc)" \ + ; \ + nproc="$(nproc)"; \ + make -j "$nproc" \ LDFLAGS="-Wl,--strip-all" \ - && make install \ - && rm -rf /usr/src/python \ + ; \ + make install; \ + cd /; \ + rm -rf /usr/src/python; \ \ - && find /usr/local -depth \ + find /usr/local -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ \) -exec rm -rf '{}' + \ + ; \ \ - && ldconfig \ + ldconfig; \ \ - && apt-mark auto '.*' > /dev/null \ - && apt-mark manual $savedAptMark \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ | awk '/=>/ { print $(NF-1) }' \ | sort -u \ | xargs -r dpkg-query --search \ | cut -d: -f1 \ | sort -u \ | xargs -r apt-mark manual \ - && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ - && rm -rf /var/lib/apt/lists/* \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ \ - && python3 --version + python3 --version -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 21.2.4 @@ -116,17 +125,17 @@ ENV PYTHON_SETUPTOOLS_VERSION 57.5.0 ENV PYTHON_GET_PIP_URL https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py ENV PYTHON_GET_PIP_SHA256 c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309 -RUN set -ex; \ +RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ apt-get update; \ apt-get install -y --no-install-recommends wget; \ \ wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ \ apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ rm -rf /var/lib/apt/lists/*; \ \ @@ -143,7 +152,8 @@ RUN set -ex; \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ -o \ \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ + \) -exec rm -rf '{}' + \ + ; \ rm -f get-pip.py CMD ["python3"] diff --git a/3.9/windows/windowsservercore-1809/Dockerfile b/3.9/windows/windowsservercore-1809/Dockerfile index 628f3e9f1..2bc53863f 100644 --- a/3.9/windows/windowsservercore-1809/Dockerfile +++ b/3.9/windows/windowsservercore-1809/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -12,9 +12,8 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref ENV PYTHONIOENCODING UTF-8 ENV PYTHON_VERSION 3.9.10 -ENV PYTHON_RELEASE 3.9.10 -RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f ($env:PYTHON_VERSION -replace '[a-z]+[0-9]*$', ''), $env:PYTHON_VERSION); \ Write-Host ('Downloading {0} ...' -f $url); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ diff --git a/3.9/windows/windowsservercore-ltsc2022/Dockerfile b/3.9/windows/windowsservercore-ltsc2022/Dockerfile index 91cb3e7db..3c66745fa 100644 --- a/3.9/windows/windowsservercore-ltsc2022/Dockerfile +++ b/3.9/windows/windowsservercore-ltsc2022/Dockerfile @@ -1,5 +1,5 @@ # -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # @@ -12,9 +12,8 @@ SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPref ENV PYTHONIOENCODING UTF-8 ENV PYTHON_VERSION 3.9.10 -ENV PYTHON_RELEASE 3.9.10 -RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f ($env:PYTHON_VERSION -replace '[a-z]+[0-9]*$', ''), $env:PYTHON_VERSION); \ Write-Host ('Downloading {0} ...' -f $url); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template deleted file mode 100644 index 3f8422396..000000000 --- a/Dockerfile-alpine.template +++ /dev/null @@ -1,177 +0,0 @@ -FROM alpine:%%PLACEHOLDER%% - -# ensure local python is preferred over distribution python -ENV PATH /usr/local/bin:$PATH - -# http://bugs.python.org/issue19846 -# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. -ENV LANG C.UTF-8 - -# runtime dependencies -RUN set -eux; \ - apk add --no-cache \ -# install ca-certificates so that HTTPS works consistently - ca-certificates \ -# and tzdata for PEP 615 (https://www.python.org/dev/peps/pep-0615/) - tzdata \ - ; -# other runtime dependencies for Python are installed later - -ENV GPG_KEY %%PLACEHOLDER%% -ENV PYTHON_VERSION %%PLACEHOLDER%% - -RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps \ - gnupg \ - tar \ - xz \ - \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && apk add --no-cache --virtual .build-deps \ - bluez-dev \ - bzip2-dev \ - coreutils \ - dpkg-dev dpkg \ - expat-dev \ - findutils \ - gcc \ - gdbm-dev \ - libc-dev \ - libffi-dev \ - libnsl-dev \ - libtirpc-dev \ - linux-headers \ - make \ - ncurses-dev \ - openssl-dev \ - pax-utils \ - readline-dev \ - sqlite-dev \ - tcl-dev \ - tk \ - tk-dev \ - util-linux-dev \ - xz-dev \ - zlib-dev \ -# add build deps before removing fetch deps in case there's overlap - && apk del --no-network .fetch-deps \ - \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ - --build="$gnuArch" \ - --enable-loadable-sqlite-extensions \ - --enable-optimizations \ - --enable-option-checking=fatal \ - --enable-shared \ - --with-lto \ - --with-system-expat \ - --with-system-ffi \ - --without-ensurepip \ - && 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" \ -# 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 \ - ' \ - && make install \ - && rm -rf /usr/src/python \ - \ - && find /usr/local -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ - -o \( -type f -a -name 'wininst-*.exe' \) \ - \) -exec rm -rf '{}' + \ - \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - | xargs -rt apk add --no-cache --virtual .python-rundeps \ - && apk del --no-network .build-deps \ - \ - && python3 --version - -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config - -# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION %%PLACEHOLDER%% -# https://github.com/docker-library/python/issues/365 -ENV PYTHON_SETUPTOOLS_VERSION %%PLACEHOLDER%% -# https://github.com/pypa/get-pip -ENV PYTHON_GET_PIP_URL %%PLACEHOLDER%% -ENV PYTHON_GET_PIP_SHA256 %%PLACEHOLDER%% - -RUN set -ex; \ - \ - wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ - \ - python get-pip.py \ - --disable-pip-version-check \ - --no-cache-dir \ - "pip==$PYTHON_PIP_VERSION" \ - "setuptools==$PYTHON_SETUPTOOLS_VERSION" \ - ; \ - pip --version; \ - \ - find /usr/local -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \ - \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ - rm -f get-pip.py - -CMD ["python3"] diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template deleted file mode 100644 index b4e7b53d0..000000000 --- a/Dockerfile-debian.template +++ /dev/null @@ -1,132 +0,0 @@ -FROM buildpack-deps:%%PLACEHOLDER%% - -# ensure local python is preferred over distribution python -ENV PATH /usr/local/bin:$PATH - -# http://bugs.python.org/issue19846 -# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. -ENV LANG C.UTF-8 - -# extra dependencies (over what buildpack-deps already includes) -RUN apt-get update && apt-get install -y --no-install-recommends \ - libbluetooth-dev \ - tk-dev \ - uuid-dev \ - && rm -rf /var/lib/apt/lists/* - -ENV GPG_KEY %%PLACEHOLDER%% -ENV PYTHON_VERSION %%PLACEHOLDER%% - -RUN set -ex \ - \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ - --build="$gnuArch" \ - --enable-loadable-sqlite-extensions \ - --enable-optimizations \ - --enable-option-checking=fatal \ - --enable-shared \ - --with-lto \ - --with-system-expat \ - --with-system-ffi \ - --without-ensurepip \ - && 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 \ - ' \ - && make install \ - && rm -rf /usr/src/python \ - \ - && find /usr/local -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ - -o \( -type f -a -name 'wininst-*.exe' \) \ - \) -exec rm -rf '{}' + \ - \ - && ldconfig \ - \ - && python3 --version - -# make some useful symlinks that are expected to exist -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config - -# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION %%PLACEHOLDER%% -# https://github.com/docker-library/python/issues/365 -ENV PYTHON_SETUPTOOLS_VERSION %%PLACEHOLDER%% -# https://github.com/pypa/get-pip -ENV PYTHON_GET_PIP_URL %%PLACEHOLDER%% -ENV PYTHON_GET_PIP_SHA256 %%PLACEHOLDER%% - -RUN set -ex; \ - \ - wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ - \ - python get-pip.py \ - --disable-pip-version-check \ - --no-cache-dir \ - "pip==$PYTHON_PIP_VERSION" \ - "setuptools==$PYTHON_SETUPTOOLS_VERSION" \ - ; \ - pip --version; \ - \ - find /usr/local -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \ - \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ - rm -f get-pip.py - -CMD ["python3"] diff --git a/Dockerfile-linux.template b/Dockerfile-linux.template new file mode 100644 index 000000000..e5d2529f0 --- /dev/null +++ b/Dockerfile-linux.template @@ -0,0 +1,321 @@ +{{ + def is_alpine: + env.variant | startswith("alpine") + ; + def is_slim: + env.variant | startswith("slim-") + ; + def rcVersion: + env.version | rtrimstr("-rc") +-}} +{{ if is_alpine then ( -}} +FROM alpine:{{ env.variant | ltrimstr("alpine") }} +{{ ) elif is_slim then ( -}} +FROM debian:{{ env.variant | ltrimstr("slim-") }}-slim +{{ ) else ( -}} +FROM buildpack-deps:{{ env.variant }} +{{ ) end -}} + +# ensure local python is preferred over distribution python +ENV PATH /usr/local/bin:$PATH + +# http://bugs.python.org/issue19846 +# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. +ENV LANG C.UTF-8 + +# runtime dependencies +{{ if is_alpine then ( -}} +RUN set -eux; \ + apk add --no-cache \ + ca-certificates \ + tzdata \ + ; +{{ ) else ( -}} +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ +{{ if is_slim then ( -}} + ca-certificates \ + netbase \ + tzdata \ +{{ ) else ( -}} + libbluetooth-dev \ + tk-dev \ + uuid-dev \ +{{ ) end -}} + ; \ + rm -rf /var/lib/apt/lists/* +{{ ) end -}} + +ENV GPG_KEY {{ + { + # gpg: key AA65421D: public key "Ned Deily (Python release signing key) " imported + "3.7": "0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D", + # https://www.python.org/dev/peps/pep-0537/#release-manager-and-crew + + # gpg: key B26995E310250568: public key "\xc5\x81ukasz Langa (GPG langa.pl) " imported + "3.8": "E3FF2839C048B25C084DEBE9B26995E310250568", + # https://www.python.org/dev/peps/pep-0569/#release-manager-and-crew + + # gpg: key B26995E310250568: public key "\xc5\x81ukasz Langa (GPG langa.pl) " imported + "3.9": "E3FF2839C048B25C084DEBE9B26995E310250568", + # https://www.python.org/dev/peps/pep-0596/#release-manager-and-crew + + # gpg: key 64E628F8D684696D: public key "Pablo Galindo Salgado " imported + "3.10": "A035C8C19219BA821ECEA86B64E628F8D684696D", + # https://www.python.org/dev/peps/pep-0619/#release-manager-and-crew + + # gpg: key 64E628F8D684696D: public key "Pablo Galindo Salgado " imported + "3.11": "A035C8C19219BA821ECEA86B64E628F8D684696D", + # https://www.python.org/dev/peps/pep-0664/#release-manager-and-crew + }[rcVersion] +}} +ENV PYTHON_VERSION {{ .version }} + +RUN set -eux; \ + \ +{{ if is_alpine then ( -}} + apk add --no-cache --virtual .build-deps \ + gnupg \ + tar \ + xz \ + \ + bluez-dev \ + bzip2-dev \ + coreutils \ + dpkg-dev dpkg \ + expat-dev \ + findutils \ + gcc \ + gdbm-dev \ + libc-dev \ + libffi-dev \ + libnsl-dev \ + libtirpc-dev \ + linux-headers \ + make \ + ncurses-dev \ + openssl-dev \ + pax-utils \ + readline-dev \ + sqlite-dev \ + tcl-dev \ + tk \ + tk-dev \ + util-linux-dev \ + xz-dev \ + zlib-dev \ + ; \ + \ +{{ ) elif is_slim then ( -}} + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + dpkg-dev \ + gcc \ + gnupg dirmngr \ + libbluetooth-dev \ + libbz2-dev \ + libc6-dev \ + libexpat1-dev \ + libffi-dev \ + libgdbm-dev \ + liblzma-dev \ + libncursesw5-dev \ + libreadline-dev \ + libsqlite3-dev \ + libssl-dev \ + make \ + tk-dev \ + uuid-dev \ + wget \ + xz-utils \ + zlib1g-dev \ + ; \ + \ +{{ ) 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; \ + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; \ + gpg --batch --verify python.tar.xz.asc python.tar.xz; \ + command -v gpgconf > /dev/null && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" python.tar.xz.asc; \ + mkdir -p /usr/src/python; \ + tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; \ + rm python.tar.xz; \ + \ + cd /usr/src/python; \ + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ + ./configure \ + --build="$gnuArch" \ + --enable-loadable-sqlite-extensions \ + --enable-optimizations \ + --enable-option-checking=fatal \ + --enable-shared \ +{{ + # <3.10 does not have -fno-semantic-interposition enabled and --with-lto does nothing for performance + if [ "3.7", "3.8", "3.9" ] | index(rcVersion) then "" else ( +-}} + --with-lto \ +{{ ) end -}} + --with-system-expat \ + --with-system-ffi \ + --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" \ +{{ ) else "" end -}} + LDFLAGS="-Wl,--strip-all" \ +{{ 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 \ + ' \ +{{ + ) 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 install; \ + cd /; \ + rm -rf /usr/src/python; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ + -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ +{{ if [ "3.7", "3.8" ] | index(env.version) then ( -}} + -o \( -type f -a -name 'wininst-*.exe' \) \ +{{ + ) else + # "wininst-*.exe" is not installed for Unix platforms on Python 3.9+: https://github.com/python/cpython/pull/14511 + "" + end +-}} + \) -exec rm -rf '{}' + \ + ; \ + \ +{{ if is_alpine then ( -}} + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec scanelf --needed --nobanner --format '%n#p' '{}' ';' \ + | tr ',' '\n' \ + | sort -u \ + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ + | xargs -rt apk add --no-network --virtual .python-rundeps \ + ; \ + apk del --no-network .build-deps; \ +{{ ) else ( -}} + ldconfig; \ +{{ if is_slim then ( -}} + \ + apt-mark auto '.*' > /dev/null; \ + apt-mark manual $savedAptMark; \ + find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ + | awk '/=>/ { print $(NF-1) }' \ + | sort -u \ + | xargs -r dpkg-query --search \ + | cut -d: -f1 \ + | sort -u \ + | xargs -r apt-mark manual \ + ; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ +{{ ) else "" end -}} +{{ ) end -}} + \ + python3 --version + +# make some useful symlinks that are expected to exist ("/usr/local/bin/python" and friends) +RUN set -eux; \ + for src in idle3 pydoc3 python3 python3-config; do \ + dst="$(echo "$src" | tr -d 3)"; \ + [ -s "/usr/local/bin/$src" ]; \ + [ ! -e "/usr/local/bin/$dst" ]; \ + ln -svT "/usr/local/bin/$src" "/usr/local/bin/$dst"; \ + done + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION {{ .pip.version }} +# https://github.com/docker-library/python/issues/365 +ENV PYTHON_SETUPTOOLS_VERSION {{ .setuptools.version }} +# https://github.com/pypa/get-pip +ENV PYTHON_GET_PIP_URL {{ .pip.url }} +ENV PYTHON_GET_PIP_SHA256 {{ .pip.sha256 }} + +RUN set -eux; \ + \ +{{ if is_slim then ( -}} + savedAptMark="$(apt-mark showmanual)"; \ + apt-get update; \ + apt-get install -y --no-install-recommends wget; \ + \ +{{ ) else "" end -}} + wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ + echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum -c -; \ + \ +{{ if is_slim then ( -}} + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ + rm -rf /var/lib/apt/lists/*; \ + \ +{{ ) else "" end -}} + python get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + "setuptools==$PYTHON_SETUPTOOLS_VERSION" \ + ; \ + pip --version; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ + -o \ + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ + \) -exec rm -rf '{}' + \ + ; \ + rm -f get-pip.py + +CMD ["python3"] diff --git a/Dockerfile-slim.template b/Dockerfile-slim.template deleted file mode 100644 index 47284e55d..000000000 --- a/Dockerfile-slim.template +++ /dev/null @@ -1,181 +0,0 @@ -FROM debian:%%PLACEHOLDER%% - -# ensure local python is preferred over distribution python -ENV PATH /usr/local/bin:$PATH - -# http://bugs.python.org/issue19846 -# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. -ENV LANG C.UTF-8 - -# runtime dependencies -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - netbase \ - tzdata \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV GPG_KEY %%PLACEHOLDER%% -ENV PYTHON_VERSION %%PLACEHOLDER%% - -RUN set -ex \ - \ - && savedAptMark="$(apt-mark showmanual)" \ - && apt-get update && apt-get install -y --no-install-recommends \ - dpkg-dev \ - gcc \ - libbluetooth-dev \ - libbz2-dev \ - libc6-dev \ - libexpat1-dev \ - libffi-dev \ - libgdbm-dev \ - liblzma-dev \ - libncursesw5-dev \ - libreadline-dev \ - libsqlite3-dev \ - libssl-dev \ - make \ - tk-dev \ - uuid-dev \ - wget \ - xz-utils \ - zlib1g-dev \ -# as of Stretch, "gpg" is no longer included by default - $(command -v gpg > /dev/null || echo 'gnupg dirmngr') \ - \ - && 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" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY" \ - && gpg --batch --verify python.tar.xz.asc python.tar.xz \ - && { command -v gpgconf > /dev/null && gpgconf --kill all || :; } \ - && rm -rf "$GNUPGHOME" python.tar.xz.asc \ - && mkdir -p /usr/src/python \ - && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ - && rm python.tar.xz \ - \ - && cd /usr/src/python \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure \ - --build="$gnuArch" \ - --enable-loadable-sqlite-extensions \ - --enable-optimizations \ - --enable-option-checking=fatal \ - --enable-shared \ - --with-lto \ - --with-system-expat \ - --with-system-ffi \ - --without-ensurepip \ - && make -j "$(nproc)" \ - 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 \ - ' \ - && make install \ - && rm -rf /usr/src/python \ - \ - && find /usr/local -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ - -o \( -type f -a -name 'wininst-*.exe' \) \ - \) -exec rm -rf '{}' + \ - \ - && ldconfig \ - \ - && apt-mark auto '.*' > /dev/null \ - && apt-mark manual $savedAptMark \ - && find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - && 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 -RUN cd /usr/local/bin \ - && ln -s idle3 idle \ - && ln -s pydoc3 pydoc \ - && ln -s python3 python \ - && ln -s python3-config python-config - -# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION %%PLACEHOLDER%% -# https://github.com/docker-library/python/issues/365 -ENV PYTHON_SETUPTOOLS_VERSION %%PLACEHOLDER%% -# https://github.com/pypa/get-pip -ENV PYTHON_GET_PIP_URL %%PLACEHOLDER%% -ENV PYTHON_GET_PIP_SHA256 %%PLACEHOLDER%% - -RUN set -ex; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends wget; \ - \ - wget -O get-pip.py "$PYTHON_GET_PIP_URL"; \ - echo "$PYTHON_GET_PIP_SHA256 *get-pip.py" | sha256sum --check --strict -; \ - \ - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ - \ - python get-pip.py \ - --disable-pip-version-check \ - --no-cache-dir \ - "pip==$PYTHON_PIP_VERSION" \ - "setuptools==$PYTHON_SETUPTOOLS_VERSION" \ - ; \ - pip --version; \ - \ - find /usr/local -depth \ - \( \ - \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \ - \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ - \) -exec rm -rf '{}' +; \ - rm -f get-pip.py - -CMD ["python3"] diff --git a/Dockerfile-windowsservercore.template b/Dockerfile-windows.template similarity index 86% rename from Dockerfile-windowsservercore.template rename to Dockerfile-windows.template index c0749ff99..e9bff5b5a 100644 --- a/Dockerfile-windowsservercore.template +++ b/Dockerfile-windows.template @@ -1,14 +1,13 @@ -FROM mcr.microsoft.com/windows/servercore:%%PLACEHOLDER%% +FROM mcr.microsoft.com/windows/{{ env.windowsVariant }}:{{ env.windowsRelease }} SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] # https://github.com/docker-library/python/pull/557 ENV PYTHONIOENCODING UTF-8 -ENV PYTHON_VERSION %%PLACEHOLDER%% -ENV PYTHON_RELEASE %%PLACEHOLDER%% +ENV PYTHON_VERSION {{ .version }} -RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f ($env:PYTHON_VERSION -replace '[a-z]+[0-9]*$', ''), $env:PYTHON_VERSION); \ Write-Host ('Downloading {0} ...' -f $url); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ Invoke-WebRequest -Uri $url -OutFile 'python.exe'; \ @@ -46,12 +45,12 @@ RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env Write-Host 'Complete.' # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION %%PLACEHOLDER%% +ENV PYTHON_PIP_VERSION {{ .pip.version }} # https://github.com/docker-library/python/issues/365 -ENV PYTHON_SETUPTOOLS_VERSION %%PLACEHOLDER%% +ENV PYTHON_SETUPTOOLS_VERSION {{ .setuptools.version }} # https://github.com/pypa/get-pip -ENV PYTHON_GET_PIP_URL %%PLACEHOLDER%% -ENV PYTHON_GET_PIP_SHA256 %%PLACEHOLDER%% +ENV PYTHON_GET_PIP_URL {{ .pip.url }} +ENV PYTHON_GET_PIP_SHA256 {{ .pip.sha256 }} RUN Write-Host ('Downloading get-pip.py ({0}) ...' -f $env:PYTHON_GET_PIP_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ diff --git a/apply-templates.sh b/apply-templates.sh new file mode 100755 index 000000000..d048d4ac7 --- /dev/null +++ b/apply-templates.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +[ -f versions.json ] # run "versions.sh" first + +jqt='.jq-template.awk' +if [ -n "${BASHBREW_SCRIPTS:-}" ]; then + jqt="$BASHBREW_SCRIPTS/jq-template.awk" +elif [ "$BASH_SOURCE" -nt "$jqt" ]; then + # https://github.com/docker-library/bashbrew/blob/master/scripts/jq-template.awk + wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/1da7341a79651d28fbcc3d14b9176593c4231942/scripts/jq-template.awk' +fi + +if [ "$#" -eq 0 ]; then + versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" + eval "set -- $versions" +fi + +generated_warning() { + cat <<-EOH + # + # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" + # + # PLEASE DO NOT EDIT IT DIRECTLY. + # + + EOH +} + +for version; do + export version + + rm -rf "$version/" + + variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)" + eval "variants=( $variants )" + + for dir in "${variants[@]}"; do + variant="$(basename "$dir")" # "buster", "windowsservercore-1809", etc + export variant + + case "$dir" in + windows/*) + windowsVariant="${variant%%-*}" # "windowsservercore", "nanoserver" + windowsRelease="${variant#$windowsVariant-}" # "ltsc2022", "1809", etc + windowsVariant="${windowsVariant#windows}" # "servercore", "nanoserver" + export windowsVariant windowsRelease + template='Dockerfile-windows.template' + ;; + + *) + template='Dockerfile-linux.template' + ;; + esac + + echo "processing $version/$dir ..." + mkdir -p "$version/$dir" + + { + generated_warning + gawk -f "$jqt" "$template" + } > "$version/$dir/Dockerfile" + done +done diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 181dac395..ada1bb1d3 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -5,20 +5,16 @@ declare -A aliases=( [3.10]='3 latest' ) -defaultDebianSuite='bullseye' -declare -A debianSuites=( - #[3.10]='bullseye' -) -defaultAlpineVersion='3.15' - self="$(basename "$BASH_SOURCE")" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" -versions=( */ ) -versions=( "${versions[@]%/}" ) +if [ "$#" -eq 0 ]; then + versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" + eval "set -- $versions" +fi # sort version numbers with highest first -IFS=$'\n'; versions=( $(echo "${versions[*]}" | sort -rV) ); unset IFS +IFS=$'\n'; set -- $(sort -rV <<<"$*"); unset IFS # get the most recent commit which modified any of "$@" fileCommit() { @@ -30,15 +26,19 @@ dirCommit() { local dir="$1"; shift ( cd "$dir" - fileCommit \ - Dockerfile \ - $(git show HEAD:./Dockerfile | awk ' + files="$( + git show HEAD:./Dockerfile | awk ' toupper($1) == "COPY" { for (i = 2; i < NF; i++) { + if ($i ~ /^--from=/) { + next + } print $i } } - ') + ' + )" + fileCommit Dockerfile $files ) } @@ -73,49 +73,59 @@ join() { echo "${out#$sep}" } -for version in "${versions[@]}"; do - rcVersion="${version%-rc}" +for version; do + export version + variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)" + eval "variants=( $variants )" - for v in \ - {bullseye,buster}{,/slim} \ - alpine{3.15,3.14} \ - windows/windowsservercore-{ltsc2022,1809} \ - ; do - dir="$version/$v" - variant="$(basename "$v")" + fullVersion="$(jq -r '.[env.version].version' versions.json)" - if [ "$variant" = 'slim' ]; then - # convert "slim" into "slim-jessie" - # https://github.com/docker-library/ruby/pull/142#issuecomment-320012893 - variant="$variant-$(basename "$(dirname "$v")")" - fi + versionAliases=( + $fullVersion + $version + ${aliases[$version]:-} + ) + defaultDebianVariant="$(jq -r ' + .[env.version].variants + | map(select( + startswith("alpine") + or startswith("slim-") + | not + )) + | .[0] + ' versions.json)" + defaultAlpineVariant="$(jq -r ' + .[env.version].variants + | map(select( + startswith("alpine") + )) + | .[0] + ' versions.json)" + + for v in "${variants[@]}"; do + dir="$version/$v" [ -f "$dir/Dockerfile" ] || continue + variant="$(basename "$v")" commit="$(dirCommit "$dir")" - fullVersion="$(git show "$commit":"$dir/Dockerfile" | awk '$1 == "ENV" && $2 == "PYTHON_VERSION" { print $3; exit }')" - - versionAliases=( - $fullVersion - $version - ${aliases[$version]:-} - ) - variantAliases=( "${versionAliases[@]/%/-$variant}" ) - debianSuite="${debianSuites[$version]:-$defaultDebianSuite}" case "$variant" in - *-"$debianSuite") # "slim-bullseye", etc need "slim" - variantAliases+=( "${versionAliases[@]/%/-${variant%-$debianSuite}}" ) + *-"$defaultDebianVariant") # slim-xxx -> slim + variantAliases+=( "${versionAliases[@]/%/-${variant%-$defaultDebianVariant}}" ) ;; - "alpine${defaultAlpineVersion}") + "$defaultAlpineVariant") variantAliases+=( "${versionAliases[@]/%/-alpine}" ) ;; esac variantAliases=( "${variantAliases[@]//latest-/}" ) case "$v" in - windows/*) variantArches='windows-amd64' ;; + windows/*) + variantArches='windows-amd64' + ;; + *) variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")" variantArches="${parentRepoToArches[$variantParent]}" @@ -130,7 +140,7 @@ for version in "${versions[@]}"; do break fi done - if [ "$variant" = "$debianSuite" ] || [[ "$variant" == 'windowsservercore'* ]]; then + if [ "$variant" = "$defaultDebianVariant" ] || [[ "$variant" == 'windowsservercore'* ]]; then sharedTags+=( "${versionAliases[@]}" ) fi @@ -149,6 +159,8 @@ for version in "${versions[@]}"; do GitCommit: $commit Directory: $dir EOE - [[ "$v" == windows/* ]] && echo "Constraints: $variant" + if [[ "$v" == windows/* ]]; then + echo "Constraints: $variant" + fi done done diff --git a/update.sh b/update.sh index 18dc9ffcd..bac2d7581 100755 --- a/update.sh +++ b/update.sh @@ -1,244 +1,7 @@ #!/usr/bin/env bash set -Eeuo pipefail -shopt -s nullglob - -# https://www.python.org/downloads/ (under "OpenPGP Public Keys") -declare -A gpgKeys=( - # gpg: key AA65421D: public key "Ned Deily (Python release signing key) " imported - [3.7]='0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D' - # https://www.python.org/dev/peps/pep-0537/#release-manager-and-crew - - # gpg: key B26995E310250568: public key "\xc5\x81ukasz Langa (GPG langa.pl) " imported - [3.8]='E3FF2839C048B25C084DEBE9B26995E310250568' - # https://www.python.org/dev/peps/pep-0569/#release-manager-and-crew - - # gpg: key B26995E310250568: public key "\xc5\x81ukasz Langa (GPG langa.pl) " imported - [3.9]='E3FF2839C048B25C084DEBE9B26995E310250568' - # https://www.python.org/dev/peps/pep-0596/#release-manager-and-crew - - # gpg: key 64E628F8D684696D: public key "Pablo Galindo Salgado " imported - [3.10]='A035C8C19219BA821ECEA86B64E628F8D684696D' - # https://www.python.org/dev/peps/pep-0619/#release-manager-and-crew - - # gpg: key 64E628F8D684696D: public key "Pablo Galindo Salgado " imported - [3.11]='A035C8C19219BA821ECEA86B64E628F8D684696D' - # https://www.python.org/dev/peps/pep-0664/#release-manager-and-crew -) - -# https://github.com/docker-library/python/issues/365 -# https://pypi.org/project/pip/#history -declare -A pipVersions=( - [3.11]='21.2' # https://github.com/python/cpython/blob/v3.11.0a1/Lib/ensurepip/__init__.py -- "_PIP_VERSION" - [3.10]='21.2' # https://github.com/python/cpython/blob/3.10/Lib/ensurepip/__init__.py -- "_PIP_VERSION" - [3.9]='21.2' # https://github.com/python/cpython/blob/3.9/Lib/ensurepip/__init__.py -- "_PIP_VERSION" - [3.8]='21.2' # historical - [3.7]='21.2' # historical -) -# https://pypi.org/project/setuptools/#history -declare -A setuptoolsVersions=( - [3.11]='57' # https://github.com/python/cpython/blob/v3.11.0a1/Lib/ensurepip/__init__.py -- "_SETUPTOOLS_VERSION" - [3.10]='57' # https://github.com/python/cpython/blob/3.10/Lib/ensurepip/__init__.py -- "_SETUPTOOLS_VERSION" - [3.9]='57' # https://github.com/python/cpython/blob/3.9/Lib/ensurepip/__init__.py -- "_SETUPTOOLS_VERSION" - [3.8]='57' # historical - [3.7]='57' # historical -) -# https://pypi.org/project/wheel/#history -# TODO wheelVersions: https://github.com/docker-library/python/issues/365#issuecomment-914669320 cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" -versions=( "$@" ) -if [ ${#versions[@]} -eq 0 ]; then - versions=( */ ) -fi -versions=( "${versions[@]%/}" ) - -pipJson="$(curl -fsSL 'https://pypi.org/pypi/pip/json')" -setuptoolsJson="$(curl -fsSL 'https://pypi.org/pypi/setuptools/json')" - -getPipCommit="$(curl -fsSL 'https://github.com/pypa/get-pip/commits/main/public/get-pip.py.atom' | tac|tac | awk -F '[[:space:]]*[<>/]+' '$2 == "id" && $3 ~ /Commit/ { print $4; exit }')" -getPipUrl="https://github.com/pypa/get-pip/raw/$getPipCommit/public/get-pip.py" -getPipSha256="$(curl -fsSL "$getPipUrl" | sha256sum | cut -d' ' -f1)" - -generated_warning() { - cat <<-EOH - # - # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" - # - # PLEASE DO NOT EDIT IT DIRECTLY. - # - - EOH -} - -is_good_version() { - local dir="$1"; shift - local dirVersion="$1"; shift - local fullVersion="$1"; shift - - if ! wget -q -O /dev/null -o /dev/null --spider "https://www.python.org/ftp/python/$dirVersion/Python-$fullVersion.tar.xz"; then - return 1 - fi - - if [ -d "$dir/windows" ] && ! wget -q -O /dev/null -o /dev/null --spider "https://www.python.org/ftp/python/$dirVersion/python-$fullVersion-amd64.exe"; then - return 1 - fi - - return 0 -} - -for version in "${versions[@]}"; do - rcVersion="${version%-rc}" - rcGrepV='-v' - if [ "$rcVersion" != "$version" ]; then - rcGrepV= - fi - - possibles=( $( - { - git ls-remote --tags https://github.com/python/cpython.git "refs/tags/v${rcVersion}.*" \ - | sed -r 's!^.*refs/tags/v([0-9a-z.]+).*$!\1!' \ - | grep $rcGrepV -E -- '[a-zA-Z]+' \ - || : - - # this page has a very aggressive varnish cache in front of it, which is why we also scrape tags from GitHub - curl -fsSL 'https://www.python.org/ftp/python/' \ - | grep '&2 - exit 1 - fi - - pipVersion="${pipVersions[$rcVersion]}" - pipVersion="$( - export pipVersion - jq <<<"$pipJson" -r ' - .releases - | [ - keys_unsorted[] - | select(. == env.pipVersion or startswith(env.pipVersion + ".")) - ] - | max_by(split(".") | map(tonumber)) - ' - )" - setuptoolsVersion="${setuptoolsVersions[$rcVersion]}" - setuptoolsVersion="$( - export setuptoolsVersion - jq <<<"$setuptoolsJson" -r ' - .releases - | [ - keys_unsorted[] - | select(. == env.setuptoolsVersion or startswith(env.setuptoolsVersion + ".")) - ] - | max_by(split(".") | map(tonumber)) - ' - )" - - echo "$version: $fullVersion (pip $pipVersion, setuptools $setuptoolsVersion)" - - for v in \ - alpine{3.15,3.14} \ - {buster,bullseye}{/slim,} \ - windows/windowsservercore-{ltsc2022,1809} \ - ; do - dir="$version/$v" - variant="$(basename "$v")" - - [ -d "$dir" ] || continue - - case "$variant" in - slim) template="$variant"; tag="$(basename "$(dirname "$dir")")" ;; - windowsservercore-*) template='windowsservercore'; tag="${variant#*-}" ;; - alpine*) template='alpine'; tag="${variant#alpine}" ;; - *) template='debian'; tag="$variant" ;; - esac - if [ "$variant" = 'slim' ]; then - # use "debian:*-slim" variants for "python:*-slim" variants - tag+='-slim' - fi - template="Dockerfile-${template}.template" - - { generated_warning; cat "$template"; } > "$dir/Dockerfile" - - sed -ri \ - -e 's/^(ENV GPG_KEY) .*/\1 '"${gpgKeys[$version]:-${gpgKeys[$rcVersion]}}"'/' \ - -e 's/^(ENV PYTHON_VERSION) .*/\1 '"$fullVersion"'/' \ - -e 's/^(ENV PYTHON_RELEASE) .*/\1 '"${fullVersion%%[a-z]*}"'/' \ - -e 's/^(ENV PYTHON_PIP_VERSION) .*/\1 '"$pipVersion"'/' \ - -e 's/^(ENV PYTHON_SETUPTOOLS_VERSION) .*/\1 '"$setuptoolsVersion"'/' \ - -e 's!^(ENV PYTHON_GET_PIP_URL) .*!\1 '"$getPipUrl"'!' \ - -e 's!^(ENV PYTHON_GET_PIP_SHA256) .*!\1 '"$getPipSha256"'!' \ - -e 's/^(FROM python):.*/\1:'"$version-$tag"'/' \ - -e 's!^(FROM (debian|buildpack-deps|alpine|mcr[.]microsoft[.]com/[^:]+)):.*!\1:'"$tag"'!' \ - "$dir/Dockerfile" - - major="${rcVersion%%.*}" - minor="${rcVersion#$major.}" - minor="${minor%%.*}" - - if [ "$minor" -ge 8 ]; then - # 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 - perl -0 -i -p -e "s![^\n]+PROFILE_TASK(='[^']+?')?[^\n]+\n!!gs" "$dir/Dockerfile" - fi - if [ "$minor" -ge 9 ]; then - # "wininst-*.exe" is not installed for Unix platforms on Python 3.9+: https://github.com/python/cpython/pull/14511 - sed -ri -e '/wininst/d' "$dir/Dockerfile" - fi - - # https://www.python.org/dev/peps/pep-0615/ - # https://mail.python.org/archives/list/python-dev@python.org/thread/PYXET7BHSETUJHSLFREM5TDZZXDTDTLY/ - if [ "$minor" -lt 9 ]; then - sed -ri -e '/tzdata/d' "$dir/Dockerfile" - fi - - if [ "$minor" -lt 10 ]; then - # <3.10 does not have -fno-semantic-interposition enabled and --with-lto does nothing for performance - sed -ri -e '/with-lto/d' "$dir/Dockerfile" - fi - done -done +./versions.sh "$@" +./apply-templates.sh "$@" diff --git a/versions.json b/versions.json new file mode 100644 index 000000000..0f5f94212 --- /dev/null +++ b/versions.json @@ -0,0 +1,103 @@ +{ + "3.10": { + "pip": { + "sha256": "c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309", + "url": "https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py", + "version": "21.2.4" + }, + "setuptools": { + "version": "57.5.0" + }, + "variants": [ + "bullseye", + "slim-bullseye", + "buster", + "slim-buster", + "alpine3.15", + "alpine3.14", + "windows/windowsservercore-ltsc2022", + "windows/windowsservercore-1809" + ], + "version": "3.10.2" + }, + "3.11-rc": { + "pip": { + "sha256": "c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309", + "url": "https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py", + "version": "21.2.4" + }, + "setuptools": { + "version": "57.5.0" + }, + "variants": [ + "bullseye", + "slim-bullseye", + "buster", + "slim-buster", + "alpine3.15", + "alpine3.14", + "windows/windowsservercore-ltsc2022", + "windows/windowsservercore-1809" + ], + "version": "3.11.0a4" + }, + "3.7": { + "pip": { + "sha256": "c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309", + "url": "https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py", + "version": "21.2.4" + }, + "setuptools": { + "version": "57.5.0" + }, + "variants": [ + "bullseye", + "slim-bullseye", + "buster", + "slim-buster", + "alpine3.15", + "alpine3.14" + ], + "version": "3.7.12" + }, + "3.8": { + "pip": { + "sha256": "c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309", + "url": "https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py", + "version": "21.2.4" + }, + "setuptools": { + "version": "57.5.0" + }, + "variants": [ + "bullseye", + "slim-bullseye", + "buster", + "slim-buster", + "alpine3.15", + "alpine3.14" + ], + "version": "3.8.12" + }, + "3.9": { + "pip": { + "sha256": "c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309", + "url": "https://github.com/pypa/get-pip/raw/3cb8888cc2869620f57d5d2da64da38f516078c7/public/get-pip.py", + "version": "21.2.4" + }, + "setuptools": { + "version": "57.5.0" + }, + "variants": [ + "bullseye", + "slim-bullseye", + "buster", + "slim-buster", + "alpine3.15", + "alpine3.14", + "windows/windowsservercore-ltsc2022", + "windows/windowsservercore-1809" + ], + "version": "3.9.10" + } +} diff --git a/versions.sh b/versions.sh new file mode 100755 index 000000000..a36371eb3 --- /dev/null +++ b/versions.sh @@ -0,0 +1,201 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +shopt -s nullglob + +# TODO https://github.com/docker-library/python/pull/686 +# https://github.com/docker-library/python/issues/365 +# https://pypi.org/project/pip/#history +declare -A pipVersions=( + [3.11]='21.2' # https://github.com/python/cpython/blob/v3.11.0a1/Lib/ensurepip/__init__.py -- "_PIP_VERSION" + [3.10]='21.2' # https://github.com/python/cpython/blob/3.10/Lib/ensurepip/__init__.py -- "_PIP_VERSION" + [3.9]='21.2' # https://github.com/python/cpython/blob/3.9/Lib/ensurepip/__init__.py -- "_PIP_VERSION" + [3.8]='21.2' # historical + [3.7]='21.2' # historical +) +# https://pypi.org/project/setuptools/#history +declare -A setuptoolsVersions=( + [3.11]='57' # https://github.com/python/cpython/blob/v3.11.0a1/Lib/ensurepip/__init__.py -- "_SETUPTOOLS_VERSION" + [3.10]='57' # https://github.com/python/cpython/blob/3.10/Lib/ensurepip/__init__.py -- "_SETUPTOOLS_VERSION" + [3.9]='57' # https://github.com/python/cpython/blob/3.9/Lib/ensurepip/__init__.py -- "_SETUPTOOLS_VERSION" + [3.8]='57' # historical + [3.7]='57' # historical +) +# https://pypi.org/project/wheel/#history +# TODO wheelVersions: https://github.com/docker-library/python/issues/365#issuecomment-914669320 + +cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" + +versions=( "$@" ) +if [ ${#versions[@]} -eq 0 ]; then + versions=( */ ) + json='{}' +else + json="$(< versions.json)" +fi +versions=( "${versions[@]%/}" ) + +pipJson="$(curl -fsSL 'https://pypi.org/pypi/pip/json')" +setuptoolsJson="$(curl -fsSL 'https://pypi.org/pypi/setuptools/json')" + +getPipCommit="$(curl -fsSL 'https://github.com/pypa/get-pip/commits/main/public/get-pip.py.atom' | tac|tac | awk -F '[[:space:]]*[<>/]+' '$2 == "id" && $3 ~ /Commit/ { print $4; exit }')" +getPipUrl="https://github.com/pypa/get-pip/raw/$getPipCommit/public/get-pip.py" +getPipSha256="$(curl -fsSL "$getPipUrl" | sha256sum | cut -d' ' -f1)" +export getPipUrl getPipSha256 + +has_linux_version() { + local dir="$1"; shift + local dirVersion="$1"; shift + local fullVersion="$1"; shift + + if ! wget -q -O /dev/null -o /dev/null --spider "https://www.python.org/ftp/python/$dirVersion/Python-$fullVersion.tar.xz"; then + return 1 + fi + + return 0 +} + +has_windows_version() { + local dir="$1"; shift + local dirVersion="$1"; shift + local fullVersion="$1"; shift + + if ! wget -q -O /dev/null -o /dev/null --spider "https://www.python.org/ftp/python/$dirVersion/python-$fullVersion-amd64.exe"; then + return 1 + fi + + return 0 +} + +for version in "${versions[@]}"; do + rcVersion="${version%-rc}" + export version rcVersion + + rcGrepV='-v' + if [ "$rcVersion" != "$version" ]; then + rcGrepV= + fi + + possibles=( $( + { + git ls-remote --tags https://github.com/python/cpython.git "refs/tags/v${rcVersion}.*" \ + | sed -r 's!^.*refs/tags/v([0-9a-z.]+).*$!\1!' \ + | grep $rcGrepV -E -- '[a-zA-Z]+' \ + || : + + # this page has a very aggressive varnish cache in front of it, which is why we also scrape tags from GitHub + curl -fsSL 'https://www.python.org/ftp/python/' \ + | grep '&2 + exit 1 + fi + + pipVersion="${pipVersions[$rcVersion]}" + pipVersion="$( + export pipVersion + jq <<<"$pipJson" -r ' + .releases + | [ + keys_unsorted[] + | select(. == env.pipVersion or startswith(env.pipVersion + ".")) + ] + | max_by(split(".") | map(tonumber)) + ' + )" + setuptoolsVersion="${setuptoolsVersions[$rcVersion]}" + setuptoolsVersion="$( + export setuptoolsVersion + jq <<<"$setuptoolsJson" -r ' + .releases + | [ + keys_unsorted[] + | select(. == env.setuptoolsVersion or startswith(env.setuptoolsVersion + ".")) + ] + | max_by(split(".") | map(tonumber)) + ' + )" + + echo "$version: $fullVersion (pip $pipVersion, setuptools $setuptoolsVersion${hasWindows:+, windows})" + + export fullVersion pipVersion setuptoolsVersion hasWindows + json="$(jq <<<"$json" -c ' + .[env.version] = { + version: env.fullVersion, + pip: { + version: env.pipVersion, + url: env.getPipUrl, + sha256: env.getPipSha256, + }, + setuptools: { + version: env.setuptoolsVersion, + }, + variants: [ + ( + "bullseye", + "buster" + | ., "slim-" + .), # https://github.com/docker-library/ruby/pull/142#issuecomment-320012893 + ( + "3.15", + "3.14" + | "alpine" + .), + if env.hasWindows != "" then + ( + "ltsc2022", + "1809" + | "windows/windowsservercore-" + .) + else empty end + ], + } + ')" +done + +jq <<<"$json" -S . > versions.json