From 2150d83a7845387a6db739be50bd68d23501c763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira=20Loff?= Date: Mon, 23 Sep 2019 13:49:23 +0100 Subject: [PATCH 01/14] Add permissions for entrypoint.sh inside containers --- 2.7-onbuild/Dockerfile | 10 ++++++---- 2.7-slim/Dockerfile | 10 ++++++---- 3.6-onbuild/Dockerfile | 10 ++++++---- 3.6-slim/Dockerfile | 10 ++++++---- 3.7-onbuild/Dockerfile | 10 ++++++---- 3.7-slim/Dockerfile | 10 ++++++---- 6 files changed, 36 insertions(+), 24 deletions(-) diff --git a/2.7-onbuild/Dockerfile b/2.7-onbuild/Dockerfile index 934a90d..89143ce 100644 --- a/2.7-onbuild/Dockerfile +++ b/2.7-onbuild/Dockerfile @@ -57,6 +57,9 @@ ENV PYTHON_PATH=/usr/local/bin/ \ git \ " +# Copy in the entrypoint script -- this installs prerequisites on container start. +COPY entrypoint.sh /entrypoint.sh + RUN set -ex ;\ # find MAJOR and MINOR python versions based on $PYTHON_VERSION export PYTHON_MAJOR_VERSION=$(echo "${PYTHON_VERSION}" | rev | cut -d"." -f3- | rev) ;\ @@ -102,10 +105,9 @@ RUN set -ex ;\ ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ # remove build dependencies and any leftover apk cache apk del --no-cache --purge .build-deps ;\ - rm -rf /var/cache/apk/* - -# Copy in the entrypoint script -- this installs prerequisites on container start. -COPY entrypoint.sh /entrypoint.sh + rm -rf /var/cache/apk/* ;\ + # set proper permission to run entrypoint script + chmod /entrypoint.sh a+x # install requirements # this way when you build you won't need to install again diff --git a/2.7-slim/Dockerfile b/2.7-slim/Dockerfile index 02d205c..583c615 100644 --- a/2.7-slim/Dockerfile +++ b/2.7-slim/Dockerfile @@ -55,6 +55,9 @@ ENV PYTHON_PATH=/usr/local/bin/ \ git \ " +# Copy in the entrypoint script -- this installs prerequisites on container start. +COPY entrypoint.sh /entrypoint.sh + RUN set -ex ;\ # find MAJOR and MINOR python versions based on $PYTHON_VERSION export PYTHON_MAJOR_VERSION=$(echo "${PYTHON_VERSION}" | rev | cut -d"." -f3- | rev) ;\ @@ -98,10 +101,9 @@ RUN set -ex ;\ ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ # remove build dependencies and any leftover apk cache apk del --no-cache --purge .build-deps ;\ - rm -rf /var/cache/apk/* - -# Copy in the entrypoint script -- this installs prerequisites on container start. -COPY entrypoint.sh /entrypoint.sh + rm -rf /var/cache/apk/* ;\ + # set proper permission to run entrypoint script + chmod /entrypoint.sh a+x # This script installs APK and Pip prerequisites on container start, or ONBUILD. Notes: # * Reads the -a flags and /apk-requirements.txt for install requests diff --git a/3.6-onbuild/Dockerfile b/3.6-onbuild/Dockerfile index 4ce0ff9..fa987e9 100644 --- a/3.6-onbuild/Dockerfile +++ b/3.6-onbuild/Dockerfile @@ -57,6 +57,9 @@ ENV PYTHON_PATH=/usr/local/bin/ \ git \ " +# Copy in the entrypoint script -- this installs prerequisites on container start. +COPY entrypoint.sh /entrypoint.sh + RUN set -ex ;\ # find MAJOR and MINOR python versions based on $PYTHON_VERSION export PYTHON_MAJOR_VERSION=$(echo "${PYTHON_VERSION}" | rev | cut -d"." -f3- | rev) ;\ @@ -102,10 +105,9 @@ RUN set -ex ;\ ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ # remove build dependencies and any leftover apk cache apk del --no-cache --purge .build-deps ;\ - rm -rf /var/cache/apk/* - -# Copy in the entrypoint script -- this installs prerequisites on container start. -COPY entrypoint.sh /entrypoint.sh + rm -rf /var/cache/apk/* ;\ + # set proper permission to run entrypoint script + chmod /entrypoint.sh a+x # install requirements # this way when you build you won't need to install again diff --git a/3.6-slim/Dockerfile b/3.6-slim/Dockerfile index 7b71da7..930c6be 100644 --- a/3.6-slim/Dockerfile +++ b/3.6-slim/Dockerfile @@ -56,6 +56,9 @@ ENV PYTHON_PATH=/usr/local/bin/ \ git \ " +# Copy in the entrypoint script -- this installs prerequisites on container start. +COPY entrypoint.sh /entrypoint.sh + RUN set -ex ;\ # find MAJOR and MINOR python versions based on $PYTHON_VERSION export PYTHON_MAJOR_VERSION=$(echo "${PYTHON_VERSION}" | rev | cut -d"." -f3- | rev) ;\ @@ -99,10 +102,9 @@ RUN set -ex ;\ ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ # remove build dependencies and any leftover apk cache apk del --no-cache --purge .build-deps ;\ - rm -rf /var/cache/apk/* - -# Copy in the entrypoint script -- this installs prerequisites on container start. -COPY entrypoint.sh /entrypoint.sh + rm -rf /var/cache/apk/* ;\ + # set proper permission to run entrypoint script + chmod /entrypoint.sh a+x # This script installs APK and Pip prerequisites on container start, or ONBUILD. Notes: # * Reads the -a flags and /apk-requirements.txt for install requests diff --git a/3.7-onbuild/Dockerfile b/3.7-onbuild/Dockerfile index 25a773e..233943d 100644 --- a/3.7-onbuild/Dockerfile +++ b/3.7-onbuild/Dockerfile @@ -57,6 +57,9 @@ ENV PYTHON_PATH=/usr/local/bin/ \ git \ " +# Copy in the entrypoint script -- this installs prerequisites on container start. +COPY entrypoint.sh /entrypoint.sh + RUN set -ex ;\ # find MAJOR and MINOR python versions based on $PYTHON_VERSION export PYTHON_MAJOR_VERSION=$(echo "${PYTHON_VERSION}" | rev | cut -d"." -f3- | rev) ;\ @@ -102,10 +105,9 @@ RUN set -ex ;\ ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ # remove build dependencies and any leftover apk cache apk del --no-cache --purge .build-deps ;\ - rm -rf /var/cache/apk/* - -# Copy in the entrypoint script -- this installs prerequisites on container start. -COPY entrypoint.sh /entrypoint.sh + rm -rf /var/cache/apk/* ;\ + # set proper permission to run entrypoint script + chmod /entrypoint.sh a+x # install requirements # this way when you build you won't need to install again diff --git a/3.7-slim/Dockerfile b/3.7-slim/Dockerfile index c7e32cf..ff979b6 100644 --- a/3.7-slim/Dockerfile +++ b/3.7-slim/Dockerfile @@ -56,6 +56,9 @@ ENV PYTHON_PATH=/usr/local/bin/ \ git \ " +# Copy in the entrypoint script -- this installs prerequisites on container start. +COPY entrypoint.sh /entrypoint.sh + RUN set -ex ;\ # find MAJOR and MINOR python versions based on $PYTHON_VERSION export PYTHON_MAJOR_VERSION=$(echo "${PYTHON_VERSION}" | rev | cut -d"." -f3- | rev) ;\ @@ -99,10 +102,9 @@ RUN set -ex ;\ ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ # remove build dependencies and any leftover apk cache apk del --no-cache --purge .build-deps ;\ - rm -rf /var/cache/apk/* - -# Copy in the entrypoint script -- this installs prerequisites on container start. -COPY entrypoint.sh /entrypoint.sh + rm -rf /var/cache/apk/* ;\ + # set proper permission to run entrypoint script + chmod /entrypoint.sh a+x # This script installs APK and Pip prerequisites on container start, or ONBUILD. Notes: # * Reads the -a flags and /apk-requirements.txt for install requests From a700908156d395acb28a6f0bf1eb5eaad00c77f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira=20Loff?= Date: Mon, 23 Sep 2019 13:55:54 +0100 Subject: [PATCH 02/14] Fix previous commit ... --- 2.7-onbuild/Dockerfile | 2 +- 2.7-slim/Dockerfile | 2 +- 3.6-onbuild/Dockerfile | 2 +- 3.6-slim/Dockerfile | 2 +- 3.7-onbuild/Dockerfile | 2 +- 3.7-slim/Dockerfile | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/2.7-onbuild/Dockerfile b/2.7-onbuild/Dockerfile index 89143ce..95b1340 100644 --- a/2.7-onbuild/Dockerfile +++ b/2.7-onbuild/Dockerfile @@ -107,7 +107,7 @@ RUN set -ex ;\ apk del --no-cache --purge .build-deps ;\ rm -rf /var/cache/apk/* ;\ # set proper permission to run entrypoint script - chmod /entrypoint.sh a+x + chmod a+x /entrypoint.sh # install requirements # this way when you build you won't need to install again diff --git a/2.7-slim/Dockerfile b/2.7-slim/Dockerfile index 583c615..883ccdf 100644 --- a/2.7-slim/Dockerfile +++ b/2.7-slim/Dockerfile @@ -103,7 +103,7 @@ RUN set -ex ;\ apk del --no-cache --purge .build-deps ;\ rm -rf /var/cache/apk/* ;\ # set proper permission to run entrypoint script - chmod /entrypoint.sh a+x + chmod a+x /entrypoint.sh # This script installs APK and Pip prerequisites on container start, or ONBUILD. Notes: # * Reads the -a flags and /apk-requirements.txt for install requests diff --git a/3.6-onbuild/Dockerfile b/3.6-onbuild/Dockerfile index fa987e9..6d264c1 100644 --- a/3.6-onbuild/Dockerfile +++ b/3.6-onbuild/Dockerfile @@ -107,7 +107,7 @@ RUN set -ex ;\ apk del --no-cache --purge .build-deps ;\ rm -rf /var/cache/apk/* ;\ # set proper permission to run entrypoint script - chmod /entrypoint.sh a+x + chmod a+x /entrypoint.sh # install requirements # this way when you build you won't need to install again diff --git a/3.6-slim/Dockerfile b/3.6-slim/Dockerfile index 930c6be..72b2847 100644 --- a/3.6-slim/Dockerfile +++ b/3.6-slim/Dockerfile @@ -104,7 +104,7 @@ RUN set -ex ;\ apk del --no-cache --purge .build-deps ;\ rm -rf /var/cache/apk/* ;\ # set proper permission to run entrypoint script - chmod /entrypoint.sh a+x + chmod a+x /entrypoint.sh # This script installs APK and Pip prerequisites on container start, or ONBUILD. Notes: # * Reads the -a flags and /apk-requirements.txt for install requests diff --git a/3.7-onbuild/Dockerfile b/3.7-onbuild/Dockerfile index 233943d..63c9758 100644 --- a/3.7-onbuild/Dockerfile +++ b/3.7-onbuild/Dockerfile @@ -107,7 +107,7 @@ RUN set -ex ;\ apk del --no-cache --purge .build-deps ;\ rm -rf /var/cache/apk/* ;\ # set proper permission to run entrypoint script - chmod /entrypoint.sh a+x + chmod a+x /entrypoint.sh # install requirements # this way when you build you won't need to install again diff --git a/3.7-slim/Dockerfile b/3.7-slim/Dockerfile index ff979b6..7157086 100644 --- a/3.7-slim/Dockerfile +++ b/3.7-slim/Dockerfile @@ -104,7 +104,7 @@ RUN set -ex ;\ apk del --no-cache --purge .build-deps ;\ rm -rf /var/cache/apk/* ;\ # set proper permission to run entrypoint script - chmod /entrypoint.sh a+x + chmod a+x /entrypoint.sh # This script installs APK and Pip prerequisites on container start, or ONBUILD. Notes: # * Reads the -a flags and /apk-requirements.txt for install requests From 7bbb825e44dead5eaf1219fbc1d68e15b36579fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira=20Loff?= Date: Mon, 23 Sep 2019 15:09:53 +0100 Subject: [PATCH 03/14] Install APK requirements after removing build requirements - this could be better by using apk groups WIP --- 2.7-onbuild/entrypoint.sh | 3 +++ 2.7-slim/entrypoint.sh | 3 +++ 3.6-onbuild/entrypoint.sh | 3 +++ 3.6-slim/entrypoint.sh | 3 +++ 3.7-onbuild/entrypoint.sh | 3 +++ 3.7-slim/entrypoint.sh | 3 +++ 6 files changed, 18 insertions(+) diff --git a/2.7-onbuild/entrypoint.sh b/2.7-onbuild/entrypoint.sh index 901491a..05fef2d 100755 --- a/2.7-onbuild/entrypoint.sh +++ b/2.7-onbuild/entrypoint.sh @@ -135,6 +135,9 @@ if [[ ! -f /requirements.installed ]]; then # Remove packages that were only required for build. apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" + vlog "Installing APK requirements..." + apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" + touch /requirements.installed else vlog "/requirements.installed file exists-- skipping requirements installs." diff --git a/2.7-slim/entrypoint.sh b/2.7-slim/entrypoint.sh index 901491a..05fef2d 100755 --- a/2.7-slim/entrypoint.sh +++ b/2.7-slim/entrypoint.sh @@ -135,6 +135,9 @@ if [[ ! -f /requirements.installed ]]; then # Remove packages that were only required for build. apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" + vlog "Installing APK requirements..." + apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" + touch /requirements.installed else vlog "/requirements.installed file exists-- skipping requirements installs." diff --git a/3.6-onbuild/entrypoint.sh b/3.6-onbuild/entrypoint.sh index 901491a..05fef2d 100755 --- a/3.6-onbuild/entrypoint.sh +++ b/3.6-onbuild/entrypoint.sh @@ -135,6 +135,9 @@ if [[ ! -f /requirements.installed ]]; then # Remove packages that were only required for build. apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" + vlog "Installing APK requirements..." + apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" + touch /requirements.installed else vlog "/requirements.installed file exists-- skipping requirements installs." diff --git a/3.6-slim/entrypoint.sh b/3.6-slim/entrypoint.sh index 901491a..05fef2d 100755 --- a/3.6-slim/entrypoint.sh +++ b/3.6-slim/entrypoint.sh @@ -135,6 +135,9 @@ if [[ ! -f /requirements.installed ]]; then # Remove packages that were only required for build. apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" + vlog "Installing APK requirements..." + apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" + touch /requirements.installed else vlog "/requirements.installed file exists-- skipping requirements installs." diff --git a/3.7-onbuild/entrypoint.sh b/3.7-onbuild/entrypoint.sh index 901491a..05fef2d 100755 --- a/3.7-onbuild/entrypoint.sh +++ b/3.7-onbuild/entrypoint.sh @@ -135,6 +135,9 @@ if [[ ! -f /requirements.installed ]]; then # Remove packages that were only required for build. apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" + vlog "Installing APK requirements..." + apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" + touch /requirements.installed else vlog "/requirements.installed file exists-- skipping requirements installs." diff --git a/3.7-slim/entrypoint.sh b/3.7-slim/entrypoint.sh index 901491a..05fef2d 100644 --- a/3.7-slim/entrypoint.sh +++ b/3.7-slim/entrypoint.sh @@ -135,6 +135,9 @@ if [[ ! -f /requirements.installed ]]; then # Remove packages that were only required for build. apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" + vlog "Installing APK requirements..." + apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" + touch /requirements.installed else vlog "/requirements.installed file exists-- skipping requirements installs." From 7eb7290b5f115879f872606c7343dc36cd7f94c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira=20Loff?= Date: Mon, 23 Sep 2019 15:37:29 +0100 Subject: [PATCH 04/14] Fix entrypoint --- 2.7-onbuild/entrypoint.sh | 2 +- 2.7-slim/entrypoint.sh | 2 +- 3.6-onbuild/entrypoint.sh | 2 +- 3.6-slim/entrypoint.sh | 2 +- 3.7-onbuild/entrypoint.sh | 2 +- 3.7-slim/entrypoint.sh | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/2.7-onbuild/entrypoint.sh b/2.7-onbuild/entrypoint.sh index 05fef2d..195ee87 100755 --- a/2.7-onbuild/entrypoint.sh +++ b/2.7-onbuild/entrypoint.sh @@ -136,7 +136,7 @@ if [[ ! -f /requirements.installed ]]; then apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" vlog "Installing APK requirements..." - apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" + apk add $APK_FLAGS "${APK_REQUIREMENTS[@]}" touch /requirements.installed else diff --git a/2.7-slim/entrypoint.sh b/2.7-slim/entrypoint.sh index 05fef2d..195ee87 100755 --- a/2.7-slim/entrypoint.sh +++ b/2.7-slim/entrypoint.sh @@ -136,7 +136,7 @@ if [[ ! -f /requirements.installed ]]; then apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" vlog "Installing APK requirements..." - apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" + apk add $APK_FLAGS "${APK_REQUIREMENTS[@]}" touch /requirements.installed else diff --git a/3.6-onbuild/entrypoint.sh b/3.6-onbuild/entrypoint.sh index 05fef2d..195ee87 100755 --- a/3.6-onbuild/entrypoint.sh +++ b/3.6-onbuild/entrypoint.sh @@ -136,7 +136,7 @@ if [[ ! -f /requirements.installed ]]; then apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" vlog "Installing APK requirements..." - apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" + apk add $APK_FLAGS "${APK_REQUIREMENTS[@]}" touch /requirements.installed else diff --git a/3.6-slim/entrypoint.sh b/3.6-slim/entrypoint.sh index 05fef2d..195ee87 100755 --- a/3.6-slim/entrypoint.sh +++ b/3.6-slim/entrypoint.sh @@ -136,7 +136,7 @@ if [[ ! -f /requirements.installed ]]; then apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" vlog "Installing APK requirements..." - apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" + apk add $APK_FLAGS "${APK_REQUIREMENTS[@]}" touch /requirements.installed else diff --git a/3.7-onbuild/entrypoint.sh b/3.7-onbuild/entrypoint.sh index 05fef2d..195ee87 100755 --- a/3.7-onbuild/entrypoint.sh +++ b/3.7-onbuild/entrypoint.sh @@ -136,7 +136,7 @@ if [[ ! -f /requirements.installed ]]; then apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" vlog "Installing APK requirements..." - apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" + apk add $APK_FLAGS "${APK_REQUIREMENTS[@]}" touch /requirements.installed else diff --git a/3.7-slim/entrypoint.sh b/3.7-slim/entrypoint.sh index 05fef2d..195ee87 100644 --- a/3.7-slim/entrypoint.sh +++ b/3.7-slim/entrypoint.sh @@ -136,7 +136,7 @@ if [[ ! -f /requirements.installed ]]; then apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" vlog "Installing APK requirements..." - apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" + apk add $APK_FLAGS "${APK_REQUIREMENTS[@]}" touch /requirements.installed else From 224ec454e28b9289d30fd3d1d7c8e292b2730809 Mon Sep 17 00:00:00 2001 From: Yuriy Shatrov Date: Wed, 18 Dec 2019 17:48:46 +0300 Subject: [PATCH 05/14] Add Python 3.8 support (#65) This PR adds support for Python 3.8.0 within a series of 3.8 tags similar to previous versions. Closes #64 --- 3.8-onbuild/Dockerfile | 123 ++++++++++++++++++++++++++++++ 3.8-onbuild/entrypoint.sh | 153 ++++++++++++++++++++++++++++++++++++++ 3.8-slim/Dockerfile | 115 ++++++++++++++++++++++++++++ 3.8-slim/entrypoint.sh | 153 ++++++++++++++++++++++++++++++++++++++ 3.8/Dockerfile | 112 ++++++++++++++++++++++++++++ 5 files changed, 656 insertions(+) create mode 100644 3.8-onbuild/Dockerfile create mode 100755 3.8-onbuild/entrypoint.sh create mode 100644 3.8-slim/Dockerfile create mode 100644 3.8-slim/entrypoint.sh create mode 100644 3.8/Dockerfile diff --git a/3.8-onbuild/Dockerfile b/3.8-onbuild/Dockerfile new file mode 100644 index 0000000..0f67794 --- /dev/null +++ b/3.8-onbuild/Dockerfile @@ -0,0 +1,123 @@ +FROM alpine:3.8 + +# VERSIONS +ENV ALPINE_VERSION=3.8 \ + PYTHON_VERSION=3.8.0 + +# PATHS +ENV PYTHON_PATH=/usr/local/bin/ \ + PATH="/usr/local/lib/python$PYTHON_VERSION/bin/:/usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin:${PATH}" \ + # These are always installed. + # * dumb-init: a proper init system for containers, to reap zombie children + # * musl: standard C library + # * lib6-compat: compatibility libraries for glibc + # * linux-headers: commonly needed, and an unusual package name from Alpine. + # * build-base: used so we include the basic development packages (gcc) + # * bash: so we can access /bin/bash + # * git: to ease up clones of repos + # * ca-certificates: for SSL verification during Pip and easy_install + PACKAGES="\ + dumb-init \ + musl \ + libc6-compat \ + linux-headers \ + build-base \ + bash \ + git \ + ca-certificates \ + libssl1.0 \ + tzdata \ + " \ + # PACKAGES needed to built python + PYTHON_BUILD_PACKAGES="\ + bzip2-dev \ + coreutils \ + dpkg \ + dpkg-dev \ + expat-dev \ + findutils \ + gcc \ + gdbm-dev \ + libc-dev \ + libffi-dev \ + libnsl-dev \ + libtirpc-dev \ + linux-headers \ + make \ + ncurses-dev \ + libressl-dev \ + pax-utils \ + readline-dev \ + sqlite-dev \ + tcl-dev \ + tk \ + tk-dev \ + util-linux-dev \ + xz-dev \ + zlib-dev \ + " + +# Copy in the entrypoint script -- this installs prerequisites on container start. +COPY entrypoint.sh /entrypoint.sh + +RUN set -ex ;\ + # find MAJOR and MINOR python versions based on $PYTHON_VERSION + export PYTHON_MAJOR_VERSION=$(echo "${PYTHON_VERSION}" | rev | cut -d"." -f3- | rev) ;\ + export PYTHON_MINOR_VERSION=$(echo "${PYTHON_VERSION}" | rev | cut -d"." -f2- | rev) ;\ + # replacing default repositories with edge ones + echo "http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/community" >> /etc/apk/repositories ;\ + echo "http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/main" >> /etc/apk/repositories ;\ + # Add the packages, with a CDN-breakage fallback if needed + apk add --no-cache $PACKAGES || \ + (sed -i -e 's/dl-cdn/dl-4/g' /etc/apk/repositories && apk add --no-cache $PACKAGES) ;\ + # Add packages just for the python build process with a CDN-breakage fallback if needed + apk add --no-cache --virtual .build-deps $PYTHON_BUILD_PACKAGES || \ + (sed -i -e 's/dl-cdn/dl-4/g' /etc/apk/repositories && apk add --no-cache --virtual .build-deps $PYTHON_BUILD_PACKAGES) ;\ + # turn back the clock -- so hacky! + echo "http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/main/" > /etc/apk/repositories ;\ + # echo "@community http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/community" >> /etc/apk/repositories ;\ + # echo "@testing http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/testing" >> /etc/apk/repositories ;\ + # echo "@edge-main http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories ;\ + # use pyenv to download and compile specific python version + git clone --depth 1 https://github.com/pyenv/pyenv /usr/local/lib/pyenv ;\ + # install + GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ;\ + PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip --with-shared" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\ + # keep the needed .so files + # ignore libpython - that one comes from the pyenv instalation + 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 }' \ + | grep -ve 'libpython' \ + | xargs -rt apk add --no-cache --virtual .python-rundeps ;\ + # for debug + # | xargs -n1 echo ;\ + # delete everything from pyenv except the installed version + # this throws an error but we ignore it + find /usr/local/lib/pyenv/ -mindepth 1 -name versions -prune -o -exec rm -rf {} \; || true ;\ + # delete files to to reduce container size + # tips taken from main python docker repo + find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ + # symlink the binaries + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + # set timezone info + ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ + # remove build dependencies and any leftover apk cache + apk del --no-cache --purge .build-deps ;\ + rm -rf /var/cache/apk/* ;\ + # set proper permission to run entrypoint script + chmod a+x /entrypoint.sh + +# install requirements +# this way when you build you won't need to install again +# and since COPY is cached we don't need to wait +ONBUILD COPY requirements.txt /tmp/requirements.txt + +# Run the dependencies installer and then allow it to be run again if needed. +ONBUILD RUN /entrypoint.sh -r /tmp/requirements.txt +ONBUILD RUN rm -f /requirements.installed + +# since we will be "always" mounting the volume, we can set this up +ENTRYPOINT ["/usr/bin/dumb-init"] +CMD ["python"] diff --git a/3.8-onbuild/entrypoint.sh b/3.8-onbuild/entrypoint.sh new file mode 100755 index 0000000..50c2ab1 --- /dev/null +++ b/3.8-onbuild/entrypoint.sh @@ -0,0 +1,153 @@ +#!/usr/bin/dumb-init /bin/bash +set -e + +APK_REQUIREMENTS=() +BUILD_REQUIREMENTS=() +PIP_REQUIREMENTS=() +APKFILE='/apk-requirements.txt' +BUILDFILE='/build-requirements.txt' +REQFILE='/requirements.txt' +VERBOSITY=1 + +TMP_REQFILE='/tmp/requirements.txt' + +function usage () { + cat <<"EOF" +Usage: $0 [-a -b -p -A -B -P -r -q -x] [--] + -a : APK requirement. Can be specified multiple times. + -b : APK build requirement. These will be removed at the end to save space. + -p : Pip requirement. Can be specified multiple times. + + -A : apk-requirements.txt file location, default: /apk-requirements.txt + -B : build-requirements.txt file location, default: /build-requirements.txt + -P : requirements.txt file location, default: /requirements.txt + -r : same as above, just to match Pip's -r flag. + + -q : quiet, doesn't print anything at all. + -x : Bash debug mode. Extremely verbose! + + -- : Separator for flags and your command + + Whatever you provide after your arguments is run at the end. +EOF + exit 1 +} + +function vlog () { + if [ $VERBOSITY -gt 0 ]; then + echo $1 + fi +} + +# Get and process arguments +while getopts ":a:b:p:A:B:P:r:qx" opt; do + case $opt in + a) APK_REQUIREMENTS+=("$OPTARG") ;; + b) BUILD_REQUIREMENTS+=("$OPTARG") ;; + p) PIP_REQUIREMENTS+=("$OPTARG") ;; + A) APKFILE="$OPTARG" ;; + B) BUILDFILE="$OPTARG" ;; + P) REQFILE="$OPTARG" ;; + r) REQFILE="$OPTARG" ;; + q) VERBOSITY=0 ;; + x) set -x ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + usage + ;; + :) + echo "Option -$OPTARG requires an argument." >&2 + usage + ;; + esac +done + +# Bad arguments +if [ $? -ne 0 ]; +then + usage +fi + +# Strip out all the arguments that have been processed +shift $((OPTIND-1)) + +# If there's a double dash at the end, get that off +[[ $1 = "--" ]] && shift + +# Make some common flags objects +PIP_FLAGS='' +if [ $VERBOSITY -eq 0 ]; then + PIP_FLAGS="$PIP_FLAGS -q" +fi + +APK_FLAGS='--no-cache --no-progress' +if [ $VERBOSITY -eq 0 ]; then + APK_FLAGS="$APK_FLAGS -q" +fi + +# Don't do anything if we've already done this. +if [[ ! -f /requirements.installed ]]; then + vlog "First run, checking for any requirements..." + + # Install any APK requirements + if [[ -f "$APKFILE" ]]; then + vlog "APK requirements file detected!" + APK_REQUIREMENTS+=($( cat "$APKFILE" )) + fi + + if [[ -f "$BUILDFILE" ]]; then + vlog "Build requirements file detected!" + BUILD_REQUIREMENTS+=($( cat "$BUILDFILE" )) + fi + + # Unfortunately the Alpine repositories are in a slightly inconsistent state for now-- python2 only exists in 'edge', not main. + # if [[ "$PYTHON_VERSION" == '2' ]]; then BUILD_PACKAGES="$(echo $BUILD_PACKAGES | sed -e 's/python2/python/g')"; fi \ + vlog "Installing all APK requirements..." + apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" "${BUILD_REQUIREMENTS[@]}" + + # Install any Pip requirements + if [[ -f "$REQFILE" && "$(cat $REQFILE | wc -l)" -gt 0 ]]; then + # Do this check a little early-- since we merge cli in with file, + # we'd get a false positive for logging otherwise. + vlog "Pip requirements file detected!" + fi + + # If we use CLI parameters, we'll have to reassign this. + TARGET_REQFILE="$REQFILE" + if [[ ${#PIP_REQUIREMENTS[@]} -gt 0 ]]; then + # Put all Pip requirements into the same file. + printf "%s\n" "${PIP_REQUIREMENTS[@]}" >> "$TMP_REQFILE" + + if [[ -f "$REQFILE" && "$(cat $REQFILE | wc -l)" -gt 0 ]]; then + cat "$REQFILE" >> "$TMP_REQFILE" + fi + + TARGET_REQFILE="$TMP_REQFILE" + fi + + if [[ -f $TARGET_REQFILE && "$(cat $TARGET_REQFILE | wc -l)" -gt 0 ]]; then + vlog "Upgrading Pip..." + pip install $PIP_FLAGS --upgrade pip + vlog "Installing all Pip requirements..." + pip install $PIP_FLAGS -r "$TARGET_REQFILE" + fi + + # Remove packages that were only required for build. + apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" + + vlog "Installing APK requirements..." + apk add $APK_FLAGS "${APK_REQUIREMENTS[@]}" + + touch /requirements.installed +else + vlog "/requirements.installed file exists-- skipping requirements installs." +fi + + +if [[ ! -z "$@" ]]; then + # If the user has given us a command, run it. + $@ +else + # Otherwise, default to running 'python'. + python +fi diff --git a/3.8-slim/Dockerfile b/3.8-slim/Dockerfile new file mode 100644 index 0000000..cff3d87 --- /dev/null +++ b/3.8-slim/Dockerfile @@ -0,0 +1,115 @@ +FROM alpine:3.8 + +# VERSIONS +ENV ALPINE_VERSION=3.8 \ + PYTHON_VERSION=3.8.0 + +# PATHS +ENV PYTHON_PATH=/usr/local/bin/ \ + PATH="/usr/local/lib/python$PYTHON_VERSION/bin/:/usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin:${PATH}" \ + # These are always installed. Notes: + # * dumb-init: a proper init system for containers, to reap zombie children + # * bash: For entrypoint, and debugging + # * ca-certificates: for SSL verification during Pip and easy_install + PACKAGES="\ + dumb-init \ + bash \ + ca-certificates \ + " \ + # PACKAGES needed to built python + PYTHON_BUILD_PACKAGES="\ + bzip2-dev \ + coreutils \ + dpkg \ + dpkg-dev \ + expat-dev \ + findutils \ + gcc \ + gdbm-dev \ + git \ + libc-dev \ + libffi-dev \ + libnsl-dev \ + libtirpc-dev \ + linux-headers \ + make \ + ncurses-dev \ + libressl-dev \ + pax-utils \ + readline-dev \ + sqlite-dev \ + tcl-dev \ + tk \ + tk-dev \ + util-linux-dev \ + xz-dev \ + zlib-dev \ + " \ + # These packages are not installed immediately, but are added at runtime or ONBUILD to shrink the image as much as possible. Notes: + # * build-base: used so we include the basic development packages (gcc) + # * linux-headers: commonly needed, and an unusual package name from Alpine. + # * lib6-compat: compatibility libraries for glibc + # * git: to ease up clones of repos + BUILD_PACKAGES="\ + build-base \ + linux-headers \ + libc6-compat \ + git \ + " + +# Copy in the entrypoint script -- this installs prerequisites on container start. +COPY entrypoint.sh /entrypoint.sh + +RUN set -ex ;\ + # find MAJOR and MINOR python versions based on $PYTHON_VERSION + export PYTHON_MAJOR_VERSION=$(echo "${PYTHON_VERSION}" | rev | cut -d"." -f3- | rev) ;\ + export PYTHON_MINOR_VERSION=$(echo "${PYTHON_VERSION}" | rev | cut -d"." -f2- | rev) ;\ + # replacing default repositories with edge ones + echo "http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/community" >> /etc/apk/repositories ;\ + echo "http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/main" >> /etc/apk/repositories ;\ + # Add the packages, with a CDN-breakage fallback if needed + apk add --no-cache $PACKAGES || \ + (sed -i -e 's/dl-cdn/dl-4/g' /etc/apk/repositories && apk add --no-cache $PACKAGES) ;\ + # Add packages just for the python build process with a CDN-breakage fallback if needed + apk add --no-cache --virtual .build-deps $PYTHON_BUILD_PACKAGES || \ + (sed -i -e 's/dl-cdn/dl-4/g' /etc/apk/repositories && apk add --no-cache --virtual .build-deps $PYTHON_BUILD_PACKAGES) ;\ + # turn back the clock -- so hacky! + echo "http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/main/" > /etc/apk/repositories ;\ + # echo "@community http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/community" >> /etc/apk/repositories ;\ + # echo "@testing http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/testing" >> /etc/apk/repositories ;\ + # echo "@edge-main http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories ;\ + # use pyenv to download and compile specific python version + git clone --depth 1 https://github.com/pyenv/pyenv /usr/local/lib/pyenv ;\ + # install + GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ;\ + PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip --with-shared" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\ + # keep the needed .so files + # ignore libpython - that one comes from the pyenv instalation + 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 }' \ + | grep -ve 'libpython' \ + | xargs -rt apk add --no-cache --virtual .python-rundeps ;\ + # for debug + # | xargs -n1 echo ;\ + # delete everything from pyenv except the installed version + # this throws an error but we ignore it + find /usr/local/lib/pyenv/ -mindepth 1 -name versions -prune -o -exec rm -rf {} \; || true ;\ + # delete files to to reduce container size + # tips taken from main python docker repo + find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ + # symlink the binaries + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + # remove build dependencies and any leftover apk cache + apk del --no-cache --purge .build-deps ;\ + rm -rf /var/cache/apk/* ;\ + # set proper permission to run entrypoint script + chmod a+x /entrypoint.sh + +# This script installs APK and Pip prerequisites on container start, or ONBUILD. Notes: +# * Reads the -a flags and /apk-requirements.txt for install requests +# * Reads the -b flags and /build-requirements.txt for build packages -- removed when build is complete +# * Reads the -p flags and /requirements.txt for Pip packages +# * Reads the -r flag to specify a different file path for /requirements.txt +ENTRYPOINT ["/usr/bin/dumb-init", "bash", "/entrypoint.sh"] diff --git a/3.8-slim/entrypoint.sh b/3.8-slim/entrypoint.sh new file mode 100644 index 0000000..50c2ab1 --- /dev/null +++ b/3.8-slim/entrypoint.sh @@ -0,0 +1,153 @@ +#!/usr/bin/dumb-init /bin/bash +set -e + +APK_REQUIREMENTS=() +BUILD_REQUIREMENTS=() +PIP_REQUIREMENTS=() +APKFILE='/apk-requirements.txt' +BUILDFILE='/build-requirements.txt' +REQFILE='/requirements.txt' +VERBOSITY=1 + +TMP_REQFILE='/tmp/requirements.txt' + +function usage () { + cat <<"EOF" +Usage: $0 [-a -b -p -A -B -P -r -q -x] [--] + -a : APK requirement. Can be specified multiple times. + -b : APK build requirement. These will be removed at the end to save space. + -p : Pip requirement. Can be specified multiple times. + + -A : apk-requirements.txt file location, default: /apk-requirements.txt + -B : build-requirements.txt file location, default: /build-requirements.txt + -P : requirements.txt file location, default: /requirements.txt + -r : same as above, just to match Pip's -r flag. + + -q : quiet, doesn't print anything at all. + -x : Bash debug mode. Extremely verbose! + + -- : Separator for flags and your command + + Whatever you provide after your arguments is run at the end. +EOF + exit 1 +} + +function vlog () { + if [ $VERBOSITY -gt 0 ]; then + echo $1 + fi +} + +# Get and process arguments +while getopts ":a:b:p:A:B:P:r:qx" opt; do + case $opt in + a) APK_REQUIREMENTS+=("$OPTARG") ;; + b) BUILD_REQUIREMENTS+=("$OPTARG") ;; + p) PIP_REQUIREMENTS+=("$OPTARG") ;; + A) APKFILE="$OPTARG" ;; + B) BUILDFILE="$OPTARG" ;; + P) REQFILE="$OPTARG" ;; + r) REQFILE="$OPTARG" ;; + q) VERBOSITY=0 ;; + x) set -x ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + usage + ;; + :) + echo "Option -$OPTARG requires an argument." >&2 + usage + ;; + esac +done + +# Bad arguments +if [ $? -ne 0 ]; +then + usage +fi + +# Strip out all the arguments that have been processed +shift $((OPTIND-1)) + +# If there's a double dash at the end, get that off +[[ $1 = "--" ]] && shift + +# Make some common flags objects +PIP_FLAGS='' +if [ $VERBOSITY -eq 0 ]; then + PIP_FLAGS="$PIP_FLAGS -q" +fi + +APK_FLAGS='--no-cache --no-progress' +if [ $VERBOSITY -eq 0 ]; then + APK_FLAGS="$APK_FLAGS -q" +fi + +# Don't do anything if we've already done this. +if [[ ! -f /requirements.installed ]]; then + vlog "First run, checking for any requirements..." + + # Install any APK requirements + if [[ -f "$APKFILE" ]]; then + vlog "APK requirements file detected!" + APK_REQUIREMENTS+=($( cat "$APKFILE" )) + fi + + if [[ -f "$BUILDFILE" ]]; then + vlog "Build requirements file detected!" + BUILD_REQUIREMENTS+=($( cat "$BUILDFILE" )) + fi + + # Unfortunately the Alpine repositories are in a slightly inconsistent state for now-- python2 only exists in 'edge', not main. + # if [[ "$PYTHON_VERSION" == '2' ]]; then BUILD_PACKAGES="$(echo $BUILD_PACKAGES | sed -e 's/python2/python/g')"; fi \ + vlog "Installing all APK requirements..." + apk add $APK_FLAGS $BUILD_PACKAGES "${APK_REQUIREMENTS[@]}" "${BUILD_REQUIREMENTS[@]}" + + # Install any Pip requirements + if [[ -f "$REQFILE" && "$(cat $REQFILE | wc -l)" -gt 0 ]]; then + # Do this check a little early-- since we merge cli in with file, + # we'd get a false positive for logging otherwise. + vlog "Pip requirements file detected!" + fi + + # If we use CLI parameters, we'll have to reassign this. + TARGET_REQFILE="$REQFILE" + if [[ ${#PIP_REQUIREMENTS[@]} -gt 0 ]]; then + # Put all Pip requirements into the same file. + printf "%s\n" "${PIP_REQUIREMENTS[@]}" >> "$TMP_REQFILE" + + if [[ -f "$REQFILE" && "$(cat $REQFILE | wc -l)" -gt 0 ]]; then + cat "$REQFILE" >> "$TMP_REQFILE" + fi + + TARGET_REQFILE="$TMP_REQFILE" + fi + + if [[ -f $TARGET_REQFILE && "$(cat $TARGET_REQFILE | wc -l)" -gt 0 ]]; then + vlog "Upgrading Pip..." + pip install $PIP_FLAGS --upgrade pip + vlog "Installing all Pip requirements..." + pip install $PIP_FLAGS -r "$TARGET_REQFILE" + fi + + # Remove packages that were only required for build. + apk del $APK_FLAGS $BUILD_PACKAGES "${BUILD_REQUIREMENTS[@]}" + + vlog "Installing APK requirements..." + apk add $APK_FLAGS "${APK_REQUIREMENTS[@]}" + + touch /requirements.installed +else + vlog "/requirements.installed file exists-- skipping requirements installs." +fi + + +if [[ ! -z "$@" ]]; then + # If the user has given us a command, run it. + $@ +else + # Otherwise, default to running 'python'. + python +fi diff --git a/3.8/Dockerfile b/3.8/Dockerfile new file mode 100644 index 0000000..f8a2e10 --- /dev/null +++ b/3.8/Dockerfile @@ -0,0 +1,112 @@ +FROM alpine:3.8 + +# VERSIONS +ENV ALPINE_VERSION=3.8 \ + PYTHON_VERSION=3.8.0 + +# PATHS +ENV PYTHON_PATH=/usr/local/bin/ \ + PATH="/usr/local/lib/python$PYTHON_VERSION/bin/:/usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin:${PATH}" \ + # These are always installed. + # * dumb-init: a proper init system for containers, to reap zombie children + # * musl: standard C library + # * lib6-compat: compatibility libraries for glibc + # * linux-headers: commonly needed, and an unusual package name from Alpine. + # * build-base: used so we include the basic development packages (gcc) + # * bash: so we can access /bin/bash + # * git: to ease up clones of repos + # * ca-certificates: for SSL verification during Pip and easy_install + PACKAGES="\ + dumb-init \ + musl \ + libc6-compat \ + linux-headers \ + build-base \ + bash \ + git \ + ca-certificates \ + libssl1.0 \ + libffi-dev \ + tzdata \ + " \ + # PACKAGES needed to built python + PYTHON_BUILD_PACKAGES="\ + bzip2-dev \ + coreutils \ + dpkg \ + dpkg-dev \ + expat-dev \ + findutils \ + gcc \ + gdbm-dev \ + libc-dev \ + libffi-dev \ + libnsl-dev \ + libtirpc-dev \ + linux-headers \ + make \ + ncurses-dev \ + libressl-dev \ + pax-utils \ + readline-dev \ + sqlite-dev \ + tcl-dev \ + tk \ + tk-dev \ + util-linux-dev \ + xz-dev \ + zlib-dev \ + " + +RUN set -ex ;\ + # find MAJOR and MINOR python versions based on $PYTHON_VERSION + export PYTHON_MAJOR_VERSION=$(echo "${PYTHON_VERSION}" | rev | cut -d"." -f3- | rev) ;\ + export PYTHON_MINOR_VERSION=$(echo "${PYTHON_VERSION}" | rev | cut -d"." -f2- | rev) ;\ + # replacing default repositories with edge ones + echo "http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/community" >> /etc/apk/repositories ;\ + echo "http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/main" >> /etc/apk/repositories ;\ + # Add the packages, with a CDN-breakage fallback if needed + apk add --no-cache $PACKAGES || \ + (sed -i -e 's/dl-cdn/dl-4/g' /etc/apk/repositories && apk add --no-cache $PACKAGES) ;\ + # Add packages just for the python build process with a CDN-breakage fallback if needed + apk add --no-cache --virtual .build-deps $PYTHON_BUILD_PACKAGES || \ + (sed -i -e 's/dl-cdn/dl-4/g' /etc/apk/repositories && apk add --no-cache --virtual .build-deps $PYTHON_BUILD_PACKAGES) ;\ + # turn back the clock -- so hacky! + echo "http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/main/" > /etc/apk/repositories ;\ + # echo "@community http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/community" >> /etc/apk/repositories ;\ + # echo "@testing http://dl-cdn.alpinelinux.org/alpine/v$ALPINE_VERSION/testing" >> /etc/apk/repositories ;\ + # echo "@edge-main http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories ;\ + # use pyenv to download and compile specific python version + git clone --depth 1 https://github.com/pyenv/pyenv /usr/local/lib/pyenv ;\ + # install + GNU_ARCH="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" ;\ + # flag explanation: + # --with-shared : python-dev + PYENV_ROOT=/usr/local/lib/pyenv CONFIGURE_OPTS="--build=$GNU_ARCH --enable-loadable-sqlite-extensions --enable-shared --with-system-expat --with-system-ffi --without-ensurepip --with-shared" /usr/local/lib/pyenv/bin/pyenv install $PYTHON_VERSION ;\ + # keep the needed .so files + # ignore libpython - that one comes from the pyenv instalation + 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 }' \ + | grep -ve 'libpython' \ + | xargs -rt apk add --no-cache --virtual .python-rundeps ;\ + # for debug + # | xargs -n1 echo ;\ + # delete everything from pyenv except the installed version + # this throws an error but we ignore it + find /usr/local/lib/pyenv/ -mindepth 1 -name versions -prune -o -exec rm -rf {} \; || true ;\ + # delete files to to reduce container size + # tips taken from main python docker repo + find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ + # symlink the binaries + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + # set timezone info + ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ + # remove build dependencies and any leftover apk cache + apk del --no-cache --purge .build-deps ;\ + rm -rf /var/cache/apk/* + +# since we will be "always" mounting the volume, we can set this up +ENTRYPOINT ["/usr/bin/dumb-init"] +CMD ["python"] From 8f848cbbb1376fbe29b58325e1f2552e14594aad Mon Sep 17 00:00:00 2001 From: Yuriy Shatrov Date: Wed, 18 Dec 2019 17:52:09 +0300 Subject: [PATCH 06/14] Fix usage text output (#63) This PR fixes the issue that the usage text is never printed to the console if invalid arguments were passed to the `entrypoint.sh` script. The culprit is that the `usage` function uses the `< -a : APK requirement. Can be specified multiple times. -b : APK build requirement. These will be removed at the end to save space. diff --git a/2.7-slim/entrypoint.sh b/2.7-slim/entrypoint.sh index 195ee87..50c2ab1 100755 --- a/2.7-slim/entrypoint.sh +++ b/2.7-slim/entrypoint.sh @@ -12,7 +12,7 @@ VERBOSITY=1 TMP_REQFILE='/tmp/requirements.txt' function usage () { - echo <<"EOF" + cat <<"EOF" Usage: $0 [-a -b -p -A -B -P -r -q -x] [--] -a : APK requirement. Can be specified multiple times. -b : APK build requirement. These will be removed at the end to save space. diff --git a/3.6-onbuild/entrypoint.sh b/3.6-onbuild/entrypoint.sh index 195ee87..50c2ab1 100755 --- a/3.6-onbuild/entrypoint.sh +++ b/3.6-onbuild/entrypoint.sh @@ -12,7 +12,7 @@ VERBOSITY=1 TMP_REQFILE='/tmp/requirements.txt' function usage () { - echo <<"EOF" + cat <<"EOF" Usage: $0 [-a -b -p -A -B -P -r -q -x] [--] -a : APK requirement. Can be specified multiple times. -b : APK build requirement. These will be removed at the end to save space. diff --git a/3.6-slim/entrypoint.sh b/3.6-slim/entrypoint.sh index 195ee87..50c2ab1 100755 --- a/3.6-slim/entrypoint.sh +++ b/3.6-slim/entrypoint.sh @@ -12,7 +12,7 @@ VERBOSITY=1 TMP_REQFILE='/tmp/requirements.txt' function usage () { - echo <<"EOF" + cat <<"EOF" Usage: $0 [-a -b -p -A -B -P -r -q -x] [--] -a : APK requirement. Can be specified multiple times. -b : APK build requirement. These will be removed at the end to save space. diff --git a/3.7-onbuild/entrypoint.sh b/3.7-onbuild/entrypoint.sh index 195ee87..50c2ab1 100755 --- a/3.7-onbuild/entrypoint.sh +++ b/3.7-onbuild/entrypoint.sh @@ -12,7 +12,7 @@ VERBOSITY=1 TMP_REQFILE='/tmp/requirements.txt' function usage () { - echo <<"EOF" + cat <<"EOF" Usage: $0 [-a -b -p -A -B -P -r -q -x] [--] -a : APK requirement. Can be specified multiple times. -b : APK build requirement. These will be removed at the end to save space. diff --git a/3.7-slim/entrypoint.sh b/3.7-slim/entrypoint.sh index 195ee87..50c2ab1 100644 --- a/3.7-slim/entrypoint.sh +++ b/3.7-slim/entrypoint.sh @@ -12,7 +12,7 @@ VERBOSITY=1 TMP_REQFILE='/tmp/requirements.txt' function usage () { - echo <<"EOF" + cat <<"EOF" Usage: $0 [-a -b -p -A -B -P -r -q -x] [--] -a : APK requirement. Can be specified multiple times. -b : APK build requirement. These will be removed at the end to save space. From ac29ff38b5b488378287076f1f0bb6ebdd41c7f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira=20Loff?= Date: Wed, 18 Dec 2019 15:02:41 +0000 Subject: [PATCH 07/14] Update travis build with 3.8 tag --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9515cc4..d131fe2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ env: global: - alpine_image='alpine:3.8' - repo='jfloff/alpine-python' - - latest='3.7' + - latest='3.8' matrix: - version='2.7' type='' - version='2.7' type='-onbuild' @@ -23,6 +23,9 @@ env: - version='3.7' type='' - version='3.7' type='-onbuild' - version='3.7' type='-slim' + - version='3.8' type='' + - version='3.8' type='-onbuild' + - version='3.8' type='-slim' before_script: - sudo docker pull $alpine_image From d3dcb619b5fbe2f3d1fd8ea6e76f5c094a95f898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira=20Loff?= Date: Wed, 18 Dec 2019 15:05:58 +0000 Subject: [PATCH 08/14] Update README.md --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 76362d4..84cb392 100644 --- a/README.md +++ b/README.md @@ -37,9 +37,12 @@ A small Python Docker image based on [Alpine Linux](http://alpinelinux.org/). * **`3.6` ([Dockerfile](https://github.com/jfloff/alpine-python/blob/master/3.6/Dockerfile))** * **`3.6-onbuild` ([Dockerfile](https://github.com/jfloff/alpine-python/blob/master/3.6-onbuild/Dockerfile))** * **`3.6-slim` ([Dockerfile](https://github.com/jfloff/alpine-python/blob/master/3.6-slim/Dockerfile))** -* **`3.7` `latest` ([Dockerfile](https://github.com/jfloff/alpine-python/blob/master/3.7/Dockerfile))** -* **`3.7-onbuild` `latest-onbuild` ([Dockerfile](https://github.com/jfloff/alpine-python/blob/master/3.7-onbuild/Dockerfile))** -* **`3.7-slim` `latest-slim` ([Dockerfile](https://github.com/jfloff/alpine-python/blob/master/3.7-slim/Dockerfile))** +* **`3.7` ([Dockerfile](https://github.com/jfloff/alpine-python/blob/master/3.7/Dockerfile))** +* **`3.7-onbuild` ([Dockerfile](https://github.com/jfloff/alpine-python/blob/master/3.7-onbuild/Dockerfile))** +* **`3.7-slim` ([Dockerfile](https://github.com/jfloff/alpine-python/blob/master/3.7-slim/Dockerfile))** +* **`3.8` `latest` ([Dockerfile](https://github.com/jfloff/alpine-python/blob/master/3.8/Dockerfile))** +* **`3.8-onbuild` `latest-onbuild` ([Dockerfile](https://github.com/jfloff/alpine-python/blob/master/3.8-onbuild/Dockerfile))** +* **`3.8-slim` `latest-slim` ([Dockerfile](https://github.com/jfloff/alpine-python/blob/master/3.8-slim/Dockerfile))** **NOTES:** - `onbuild` images install the `requirements.txt` of your project from the get go. This allows you to cache your requirements right in the build. _Make sure you are in the same directory of your `requirements.txt` file_. From aa5cd7e98a0446bb0c222f82cee92f081b430ae2 Mon Sep 17 00:00:00 2001 From: Daniel Porto Date: Fri, 27 Mar 2020 13:01:09 +0000 Subject: [PATCH 09/14] Updates Alpine 3.11 and Python 3.8.0 to 3.8.2 (#67) --- 3.6-onbuild/Dockerfile | 6 +++--- 3.6-slim/Dockerfile | 4 ++-- 3.6/Dockerfile | 6 +++--- 3.7-onbuild/Dockerfile | 6 +++--- 3.7-slim/Dockerfile | 4 ++-- 3.7/Dockerfile | 6 +++--- 3.8-onbuild/Dockerfile | 6 +++--- 3.8-slim/Dockerfile | 6 +++--- 3.8/Dockerfile | 8 ++++---- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/3.6-onbuild/Dockerfile b/3.6-onbuild/Dockerfile index 6d264c1..2c4c2bb 100644 --- a/3.6-onbuild/Dockerfile +++ b/3.6-onbuild/Dockerfile @@ -1,7 +1,7 @@ -FROM alpine:3.8 +FROM alpine:3.11 # VERSIONS -ENV ALPINE_VERSION=3.8 \ +ENV ALPINE_VERSION=3.11 \ PYTHON_VERSION=3.6.9 # PATHS @@ -25,7 +25,7 @@ ENV PYTHON_PATH=/usr/local/bin/ \ bash \ git \ ca-certificates \ - libssl1.0 \ + libressl-dev \ tzdata \ " \ # PACKAGES needed to built python diff --git a/3.6-slim/Dockerfile b/3.6-slim/Dockerfile index 72b2847..7384148 100644 --- a/3.6-slim/Dockerfile +++ b/3.6-slim/Dockerfile @@ -1,7 +1,7 @@ -FROM alpine:3.8 +FROM alpine:3.11 # VERSIONS -ENV ALPINE_VERSION=3.8 \ +ENV ALPINE_VERSION=3.11 \ PYTHON_VERSION=3.6.9 # PATHS diff --git a/3.6/Dockerfile b/3.6/Dockerfile index 362f426..9d911d7 100644 --- a/3.6/Dockerfile +++ b/3.6/Dockerfile @@ -1,7 +1,7 @@ -FROM alpine:3.8 +FROM alpine:3.11 # VERSIONS -ENV ALPINE_VERSION=3.8 \ +ENV ALPINE_VERSION=3.11 \ PYTHON_VERSION=3.6.9 # PATHS @@ -25,7 +25,7 @@ ENV PYTHON_PATH=/usr/local/bin/ \ bash \ git \ ca-certificates \ - libssl1.0 \ + libressl-dev \ tzdata \ " \ # PACKAGES needed to built python diff --git a/3.7-onbuild/Dockerfile b/3.7-onbuild/Dockerfile index 63c9758..f544ee9 100644 --- a/3.7-onbuild/Dockerfile +++ b/3.7-onbuild/Dockerfile @@ -1,7 +1,7 @@ -FROM alpine:3.8 +FROM alpine:3.11 # VERSIONS -ENV ALPINE_VERSION=3.8 \ +ENV ALPINE_VERSION=3.11 \ PYTHON_VERSION=3.7.3 # PATHS @@ -25,7 +25,7 @@ ENV PYTHON_PATH=/usr/local/bin/ \ bash \ git \ ca-certificates \ - libssl1.0 \ + libressl-dev \ tzdata \ " \ # PACKAGES needed to built python diff --git a/3.7-slim/Dockerfile b/3.7-slim/Dockerfile index 7157086..1428cad 100644 --- a/3.7-slim/Dockerfile +++ b/3.7-slim/Dockerfile @@ -1,7 +1,7 @@ -FROM alpine:3.8 +FROM alpine:3.11 # VERSIONS -ENV ALPINE_VERSION=3.8 \ +ENV ALPINE_VERSION=3.11 \ PYTHON_VERSION=3.7.3 # PATHS diff --git a/3.7/Dockerfile b/3.7/Dockerfile index 902cdac..ab8f2f0 100644 --- a/3.7/Dockerfile +++ b/3.7/Dockerfile @@ -1,7 +1,7 @@ -FROM alpine:3.8 +FROM alpine:3.11 # VERSIONS -ENV ALPINE_VERSION=3.8 \ +ENV ALPINE_VERSION=3.11 \ PYTHON_VERSION=3.7.3 # PATHS @@ -25,7 +25,7 @@ ENV PYTHON_PATH=/usr/local/bin/ \ bash \ git \ ca-certificates \ - libssl1.0 \ + libressl-dev \ libffi-dev \ tzdata \ " \ diff --git a/3.8-onbuild/Dockerfile b/3.8-onbuild/Dockerfile index 0f67794..2ccce93 100644 --- a/3.8-onbuild/Dockerfile +++ b/3.8-onbuild/Dockerfile @@ -1,8 +1,8 @@ -FROM alpine:3.8 +FROM alpine:3.11 # VERSIONS -ENV ALPINE_VERSION=3.8 \ - PYTHON_VERSION=3.8.0 +ENV ALPINE_VERSION=3.11 \ + PYTHON_VERSION=3.8.2 # PATHS ENV PYTHON_PATH=/usr/local/bin/ \ diff --git a/3.8-slim/Dockerfile b/3.8-slim/Dockerfile index cff3d87..5867f14 100644 --- a/3.8-slim/Dockerfile +++ b/3.8-slim/Dockerfile @@ -1,8 +1,8 @@ -FROM alpine:3.8 +FROM alpine:3.11 # VERSIONS -ENV ALPINE_VERSION=3.8 \ - PYTHON_VERSION=3.8.0 +ENV ALPINE_VERSION=3.11 \ + PYTHON_VERSION=3.8.2 # PATHS ENV PYTHON_PATH=/usr/local/bin/ \ diff --git a/3.8/Dockerfile b/3.8/Dockerfile index f8a2e10..de9331f 100644 --- a/3.8/Dockerfile +++ b/3.8/Dockerfile @@ -1,8 +1,8 @@ -FROM alpine:3.8 +FROM alpine:3.11 # VERSIONS -ENV ALPINE_VERSION=3.8 \ - PYTHON_VERSION=3.8.0 +ENV ALPINE_VERSION=3.11 \ + PYTHON_VERSION=3.8.2 # PATHS ENV PYTHON_PATH=/usr/local/bin/ \ @@ -25,7 +25,7 @@ ENV PYTHON_PATH=/usr/local/bin/ \ bash \ git \ ca-certificates \ - libssl1.0 \ + libressl-dev \ libffi-dev \ tzdata \ " \ From bb0dd87ceea5128e9da8de64e3d2796268f5931c Mon Sep 17 00:00:00 2001 From: Daniel Porto Date: Fri, 27 Mar 2020 13:32:28 +0000 Subject: [PATCH 10/14] Hotfix - update ssl dependency for alpine 3.11 on-build --- 3.8-onbuild/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3.8-onbuild/Dockerfile b/3.8-onbuild/Dockerfile index 2ccce93..f73a428 100644 --- a/3.8-onbuild/Dockerfile +++ b/3.8-onbuild/Dockerfile @@ -25,7 +25,7 @@ ENV PYTHON_PATH=/usr/local/bin/ \ bash \ git \ ca-certificates \ - libssl1.0 \ + libressl-dev \ tzdata \ " \ # PACKAGES needed to built python From 553d3d3edc9422fff00cb3ff88c9e66dd067e692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira=20Loff?= Date: Fri, 27 Mar 2020 21:05:10 +0000 Subject: [PATCH 11/14] link include files --- 2.7-onbuild/Dockerfile | 1 + 2.7-slim/Dockerfile | 1 + 2.7/Dockerfile | 1 + 3.6-onbuild/Dockerfile | 1 + 3.6-slim/Dockerfile | 1 + 3.6/Dockerfile | 1 + 3.7-onbuild/Dockerfile | 1 + 3.7-slim/Dockerfile | 1 + 3.7/Dockerfile | 1 + 3.8-onbuild/Dockerfile | 1 + 3.8-slim/Dockerfile | 1 + 3.8/Dockerfile | 1 + 12 files changed, 12 insertions(+) diff --git a/2.7-onbuild/Dockerfile b/2.7-onbuild/Dockerfile index 95b1340..9a710de 100644 --- a/2.7-onbuild/Dockerfile +++ b/2.7-onbuild/Dockerfile @@ -101,6 +101,7 @@ RUN set -ex ;\ find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ # symlink the binaries ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/include/python$PYTHON_MINOR_VERSION /usr/include/ ;\ # set timezone info ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ # remove build dependencies and any leftover apk cache diff --git a/2.7-slim/Dockerfile b/2.7-slim/Dockerfile index 883ccdf..ed637f4 100644 --- a/2.7-slim/Dockerfile +++ b/2.7-slim/Dockerfile @@ -99,6 +99,7 @@ RUN set -ex ;\ find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ # symlink the binaries ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/include/python$PYTHON_MINOR_VERSION /usr/include/ ;\ # remove build dependencies and any leftover apk cache apk del --no-cache --purge .build-deps ;\ rm -rf /var/cache/apk/* ;\ diff --git a/2.7/Dockerfile b/2.7/Dockerfile index 655384f..eede0f9 100644 --- a/2.7/Dockerfile +++ b/2.7/Dockerfile @@ -98,6 +98,7 @@ RUN set -ex ;\ find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ # symlink the binaries ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/include/python$PYTHON_MINOR_VERSION /usr/include/ ;\ # set timezone info ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ # remove build dependencies and any leftover apk cache diff --git a/3.6-onbuild/Dockerfile b/3.6-onbuild/Dockerfile index 2c4c2bb..08f8787 100644 --- a/3.6-onbuild/Dockerfile +++ b/3.6-onbuild/Dockerfile @@ -101,6 +101,7 @@ RUN set -ex ;\ find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ # symlink the binaries ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/include/python$PYTHON_MINOR_VERSION /usr/include/ ;\ # set timezone info ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ # remove build dependencies and any leftover apk cache diff --git a/3.6-slim/Dockerfile b/3.6-slim/Dockerfile index 7384148..976838f 100644 --- a/3.6-slim/Dockerfile +++ b/3.6-slim/Dockerfile @@ -100,6 +100,7 @@ RUN set -ex ;\ find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ # symlink the binaries ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/include/python$PYTHON_MINOR_VERSION /usr/include/ ;\ # remove build dependencies and any leftover apk cache apk del --no-cache --purge .build-deps ;\ rm -rf /var/cache/apk/* ;\ diff --git a/3.6/Dockerfile b/3.6/Dockerfile index 9d911d7..ecfbfd8 100644 --- a/3.6/Dockerfile +++ b/3.6/Dockerfile @@ -98,6 +98,7 @@ RUN set -ex ;\ find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ # symlink the binaries ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/include/python$PYTHON_MINOR_VERSION /usr/include/ ;\ # set timezone info ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ # remove build dependencies and any leftover apk cache diff --git a/3.7-onbuild/Dockerfile b/3.7-onbuild/Dockerfile index f544ee9..1303fd1 100644 --- a/3.7-onbuild/Dockerfile +++ b/3.7-onbuild/Dockerfile @@ -101,6 +101,7 @@ RUN set -ex ;\ find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ # symlink the binaries ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/include/python$PYTHON_MINOR_VERSION /usr/include/ ;\ # set timezone info ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ # remove build dependencies and any leftover apk cache diff --git a/3.7-slim/Dockerfile b/3.7-slim/Dockerfile index 1428cad..d6b7888 100644 --- a/3.7-slim/Dockerfile +++ b/3.7-slim/Dockerfile @@ -100,6 +100,7 @@ RUN set -ex ;\ find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ # symlink the binaries ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/include/python$PYTHON_MINOR_VERSION /usr/include/ ;\ # remove build dependencies and any leftover apk cache apk del --no-cache --purge .build-deps ;\ rm -rf /var/cache/apk/* ;\ diff --git a/3.7/Dockerfile b/3.7/Dockerfile index ab8f2f0..4c5c2ac 100644 --- a/3.7/Dockerfile +++ b/3.7/Dockerfile @@ -101,6 +101,7 @@ RUN set -ex ;\ find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ # symlink the binaries ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/include/python$PYTHON_MINOR_VERSION /usr/include/ ;\ # set timezone info ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ # remove build dependencies and any leftover apk cache diff --git a/3.8-onbuild/Dockerfile b/3.8-onbuild/Dockerfile index f73a428..dc13051 100644 --- a/3.8-onbuild/Dockerfile +++ b/3.8-onbuild/Dockerfile @@ -101,6 +101,7 @@ RUN set -ex ;\ find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ # symlink the binaries ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/include/python$PYTHON_MINOR_VERSION /usr/include/ ;\ # set timezone info ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ # remove build dependencies and any leftover apk cache diff --git a/3.8-slim/Dockerfile b/3.8-slim/Dockerfile index 5867f14..06aa447 100644 --- a/3.8-slim/Dockerfile +++ b/3.8-slim/Dockerfile @@ -101,6 +101,7 @@ RUN set -ex ;\ find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ # symlink the binaries ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/include/python$PYTHON_MINOR_VERSION /usr/include/ ;\ # remove build dependencies and any leftover apk cache apk del --no-cache --purge .build-deps ;\ rm -rf /var/cache/apk/* ;\ diff --git a/3.8/Dockerfile b/3.8/Dockerfile index de9331f..1c141c4 100644 --- a/3.8/Dockerfile +++ b/3.8/Dockerfile @@ -101,6 +101,7 @@ RUN set -ex ;\ find /usr/local/lib/pyenv/versions/$PYTHON_VERSION/ -depth \( -name '*.pyo' -o -name '*.pyc' -o -name 'test' -o -name 'tests' \) -exec rm -rf '{}' + ;\ # symlink the binaries ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/bin/* $PYTHON_PATH ;\ + ln -s /usr/local/lib/pyenv/versions/$PYTHON_VERSION/include/python$PYTHON_MINOR_VERSION /usr/include/ ;\ # set timezone info ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime ;\ # remove build dependencies and any leftover apk cache From 2cbadd9e16946582efa04e873948f94a1c04bb61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira=20Loff?= Date: Fri, 27 Mar 2020 21:33:27 +0000 Subject: [PATCH 12/14] Update to Alpine 3.11 on 2.7 python images. Add contribution section to README --- 2.7-onbuild/Dockerfile | 2 +- 2.7-slim/Dockerfile | 2 +- 2.7/Dockerfile | 2 +- README.md | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/2.7-onbuild/Dockerfile b/2.7-onbuild/Dockerfile index 9a710de..d6b6a2d 100644 --- a/2.7-onbuild/Dockerfile +++ b/2.7-onbuild/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.8 +FROM alpine:3.11 # VERSIONS ENV ALPINE_VERSION=3.8 \ diff --git a/2.7-slim/Dockerfile b/2.7-slim/Dockerfile index ed637f4..f8da739 100644 --- a/2.7-slim/Dockerfile +++ b/2.7-slim/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.8 +FROM alpine:3.11 # VERSIONS ENV ALPINE_VERSION=3.8 \ diff --git a/2.7/Dockerfile b/2.7/Dockerfile index eede0f9..17e5c00 100644 --- a/2.7/Dockerfile +++ b/2.7/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.8 +FROM alpine:3.11 # VERSIONS ENV ALPINE_VERSION=3.8 \ diff --git a/README.md b/README.md index 84cb392..1b362a8 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ A small Python Docker image based on [Alpine Linux](http://alpinelinux.org/). - [Debugging](#debugging) - [Additional Arguments](#additional-arguments) - [Ecosystem](#ecosystem) + - [Contribution](#contribution) - [License](#license) @@ -233,7 +234,8 @@ These are some of the images that use `jfloff/alpine-python` as base image. *If [busmuth-hub]: https://hub.docker.com/r/eggdrasyl/bismuth-node/ - +## Contribution +Feel free to contribute with whatever you feel like this image is missing. There is also some changes that happen often like, updating Alpine or Python versions. Do not forget that this repo folders mirror **Python** version and **_not_** Alpine versions. ## License The code in this repository, unless otherwise noted, is MIT licensed. See the `LICENSE` file in this repository. From 6121dfd2c7a1233da78d5b3e980cb0f77cf3d6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira=20Loff?= Date: Sat, 28 Mar 2020 14:51:31 +0000 Subject: [PATCH 13/14] Fix ALPINE_VERSION env var on 2.7 builds --- 2.7-onbuild/Dockerfile | 2 +- 2.7-slim/Dockerfile | 2 +- 2.7/Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/2.7-onbuild/Dockerfile b/2.7-onbuild/Dockerfile index d6b6a2d..91f6140 100644 --- a/2.7-onbuild/Dockerfile +++ b/2.7-onbuild/Dockerfile @@ -1,7 +1,7 @@ FROM alpine:3.11 # VERSIONS -ENV ALPINE_VERSION=3.8 \ +ENV ALPINE_VERSION=3.11 \ PYTHON_VERSION=2.7.16 # PATHS diff --git a/2.7-slim/Dockerfile b/2.7-slim/Dockerfile index f8da739..d31f322 100644 --- a/2.7-slim/Dockerfile +++ b/2.7-slim/Dockerfile @@ -1,7 +1,7 @@ FROM alpine:3.11 # VERSIONS -ENV ALPINE_VERSION=3.8 \ +ENV ALPINE_VERSION=3.11 \ PYTHON_VERSION=2.7.16 ENV PYTHON_PATH=/usr/local/bin/ \ diff --git a/2.7/Dockerfile b/2.7/Dockerfile index 17e5c00..721cffb 100644 --- a/2.7/Dockerfile +++ b/2.7/Dockerfile @@ -1,7 +1,7 @@ FROM alpine:3.11 # VERSIONS -ENV ALPINE_VERSION=3.8 \ +ENV ALPINE_VERSION=3.11 \ PYTHON_VERSION=2.7.16 # PATHS From 7ae8be3ff086e91051a478ae5fa9acb9f4ec6967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ferreira=20Loff?= Date: Sat, 28 Mar 2020 15:12:31 +0000 Subject: [PATCH 14/14] Fix libssl package for Alpine 3.11 --- 2.7-onbuild/Dockerfile | 2 +- 2.7/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/2.7-onbuild/Dockerfile b/2.7-onbuild/Dockerfile index 91f6140..c374ebc 100644 --- a/2.7-onbuild/Dockerfile +++ b/2.7-onbuild/Dockerfile @@ -25,7 +25,7 @@ ENV PYTHON_PATH=/usr/local/bin/ \ bash \ git \ ca-certificates \ - libssl1.0 \ + libressl-dev \ tzdata \ " \ # PACKAGES needed to built python diff --git a/2.7/Dockerfile b/2.7/Dockerfile index 721cffb..01384e4 100644 --- a/2.7/Dockerfile +++ b/2.7/Dockerfile @@ -25,7 +25,7 @@ ENV PYTHON_PATH=/usr/local/bin/ \ bash \ git \ ca-certificates \ - libssl1.0 \ + libressl-dev \ tzdata \ " \ # PACKAGES needed to built python