From 3d290f8d6d4692d658a1fbd0684c7747770d9516 Mon Sep 17 00:00:00 2001 From: Travis Shivers Date: Sat, 19 Sep 2020 18:24:00 -0500 Subject: [PATCH] fix: use python3 or python2 for alpine In alpine3.12, they removed the python package in favor of either python2 or python3. https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.12.0#python2_no_longer_provides_python_and_python-devel However, nodejs 12, 10 require python2 for building from source. I added a change in update.sh that swaps out python3 for python2 in those older versions for alpine Dockerfiles. Refs #1330 --- 10/alpine3.10/Dockerfile | 2 +- 10/alpine3.11/Dockerfile | 2 +- 10/alpine3.9/Dockerfile | 2 +- 12/alpine3.10/Dockerfile | 2 +- 12/alpine3.11/Dockerfile | 2 +- 12/alpine3.12/Dockerfile | 2 +- 12/alpine3.9/Dockerfile | 2 +- 14/alpine3.10/Dockerfile | 2 +- 14/alpine3.11/Dockerfile | 2 +- 14/alpine3.12/Dockerfile | 2 +- Dockerfile-alpine.template | 2 +- update.sh | 9 +++++++++ 12 files changed, 20 insertions(+), 11 deletions(-) diff --git a/10/alpine3.10/Dockerfile b/10/alpine3.10/Dockerfile index 02dc33c23d..ebad2ff468 100644 --- a/10/alpine3.10/Dockerfile +++ b/10/alpine3.10/Dockerfile @@ -33,7 +33,7 @@ RUN addgroup -g 1000 node \ libgcc \ linux-headers \ make \ - python \ + python2 \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ diff --git a/10/alpine3.11/Dockerfile b/10/alpine3.11/Dockerfile index cd6555a035..b6472e4091 100644 --- a/10/alpine3.11/Dockerfile +++ b/10/alpine3.11/Dockerfile @@ -33,7 +33,7 @@ RUN addgroup -g 1000 node \ libgcc \ linux-headers \ make \ - python \ + python2 \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ diff --git a/10/alpine3.9/Dockerfile b/10/alpine3.9/Dockerfile index f9386040b7..8cdfc97999 100644 --- a/10/alpine3.9/Dockerfile +++ b/10/alpine3.9/Dockerfile @@ -33,7 +33,7 @@ RUN addgroup -g 1000 node \ libgcc \ linux-headers \ make \ - python \ + python2 \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ diff --git a/12/alpine3.10/Dockerfile b/12/alpine3.10/Dockerfile index cd2620eee0..c9a0c86741 100644 --- a/12/alpine3.10/Dockerfile +++ b/12/alpine3.10/Dockerfile @@ -33,7 +33,7 @@ RUN addgroup -g 1000 node \ libgcc \ linux-headers \ make \ - python \ + python2 \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ diff --git a/12/alpine3.11/Dockerfile b/12/alpine3.11/Dockerfile index 5e79ebe1d0..77baec2805 100644 --- a/12/alpine3.11/Dockerfile +++ b/12/alpine3.11/Dockerfile @@ -33,7 +33,7 @@ RUN addgroup -g 1000 node \ libgcc \ linux-headers \ make \ - python \ + python2 \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ diff --git a/12/alpine3.12/Dockerfile b/12/alpine3.12/Dockerfile index 65eb5db0a2..e616a2a018 100644 --- a/12/alpine3.12/Dockerfile +++ b/12/alpine3.12/Dockerfile @@ -33,7 +33,7 @@ RUN addgroup -g 1000 node \ libgcc \ linux-headers \ make \ - python \ + python2 \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ diff --git a/12/alpine3.9/Dockerfile b/12/alpine3.9/Dockerfile index 4ef5645957..d0e502dc9f 100644 --- a/12/alpine3.9/Dockerfile +++ b/12/alpine3.9/Dockerfile @@ -33,7 +33,7 @@ RUN addgroup -g 1000 node \ libgcc \ linux-headers \ make \ - python \ + python2 \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ diff --git a/14/alpine3.10/Dockerfile b/14/alpine3.10/Dockerfile index ecfca31a42..32aaeac8eb 100644 --- a/14/alpine3.10/Dockerfile +++ b/14/alpine3.10/Dockerfile @@ -33,7 +33,7 @@ RUN addgroup -g 1000 node \ libgcc \ linux-headers \ make \ - python \ + python3 \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ diff --git a/14/alpine3.11/Dockerfile b/14/alpine3.11/Dockerfile index fa72e9d520..a7fb317b65 100644 --- a/14/alpine3.11/Dockerfile +++ b/14/alpine3.11/Dockerfile @@ -33,7 +33,7 @@ RUN addgroup -g 1000 node \ libgcc \ linux-headers \ make \ - python \ + python3 \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ diff --git a/14/alpine3.12/Dockerfile b/14/alpine3.12/Dockerfile index 22bdc75d23..9f6345587b 100644 --- a/14/alpine3.12/Dockerfile +++ b/14/alpine3.12/Dockerfile @@ -33,7 +33,7 @@ RUN addgroup -g 1000 node \ libgcc \ linux-headers \ make \ - python \ + python3 \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 34700211fd..f5c4c949f7 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -33,7 +33,7 @@ RUN addgroup -g 1000 node \ libgcc \ linux-headers \ make \ - python \ + ${PYTHON_VERSION} \ # gpg keys listed at https://github.com/nodejs/node#release-keys && for key in \ "${NODE_KEYS[@]}" diff --git a/update.sh b/update.sh index 8b66a6e55e..eaa3e78e17 100755 --- a/update.sh +++ b/update.sh @@ -167,6 +167,15 @@ function update_node_version() { )\"" sed -Ei -e "s/(alpine:)0.0/\\1${alpine_version}/" "${dockerfile}-tmp" sed -Ei -e "s/CHECKSUM=CHECKSUM_x64/CHECKSUM=${checksum}/" "${dockerfile}-tmp" + + # Use python2 for nodejs < 14 on alpine + if [ "$version" -lt 14 ]; then + pythonVersion="python2" + else + pythonVersion="python3" + fi + + sed -Ei -e 's/\$\{PYTHON_VERSION\}/'"${pythonVersion}"'/' "${dockerfile}-tmp" elif is_debian "${variant}"; then sed -Ei -e "s/(buildpack-deps:)name/\\1${variant}/" "${dockerfile}-tmp" elif is_debian_slim "${variant}"; then