Skip to content

fix: use python3 or python2 for alpine #1331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 10/alpine3.10/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion 10/alpine3.11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion 10/alpine3.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion 12/alpine3.10/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion 12/alpine3.11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion 12/alpine3.12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion 12/alpine3.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion 14/alpine3.10/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion 14/alpine3.11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion 14/alpine3.12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-alpine.template
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"
Expand Down
9 changes: 9 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably keep this as the old "python" and it would minimize the diff

Copy link
Member Author

@ttshivers ttshivers Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have to add some additional logic since "python" isn't available on alpine3.12, and there there is 12/alpine3.12

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, fair enough, was just looking to see what the minimal change would be. If this is it, that should be good

Copy link
Member Author

@ttshivers ttshivers Sep 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could add a check for alpine < 3.12 and nodejs < 14 and have it use "python" in that case. Would that be preferred?
Ex:

      if [ "$version" -lt 14 ]; then
        if (( $(echo "${alpine_version} < 3.12" | bc -l) )); then
          pythonVersion="python"
        else
          pythonVersion="python2"
        fi
      else
        pythonVersion="python3"
      fi

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it looks good now, thanks for the patients

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
Expand Down