Skip to content

Commit 4926f87

Browse files
committed
Breaking: bump Python from 2.x to 3.x (#15)
As is required for latest `node-gyp`. Some images already had Python 3 installed, now alpine and centos7-devtoolset7 do too, additionally with the `python` command linked to `python3`. Meaning `python -V` will print a 3.x version number. On centos7-devtoolset7, Python 2 remains installed because `yum` relies on it. It can also be accessed as the `python2` command.
1 parent c25cceb commit 4926f87

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
## About
1010

11-
All images include `node`, `npm`, `npx` and a preconfigured build toolchain suitable for `node-gyp` and `prebuildify`. For example:
11+
All images include Node.js LTS, Python 3.x, npm and a preconfigured build toolchain suitable for `node-gyp` and `prebuildify`. For example:
1212

1313
```
14-
> docker run --rm -it ghcr.io/prebuild/alpine node -v
14+
> docker run --rm ghcr.io/prebuild/alpine node -v
1515
v14.17.4
1616
```
1717

@@ -25,8 +25,6 @@ FROM ghcr.io/prebuild/alpine:1
2525

2626
Within a major version range, we will not change toolchains, environment variables, working directories, users and more. However, the Node.js version will change without notice. We use Node.js [LTS](https://github.com/nodejs/Release) (at the time of building images) for a light maintenance effort. This is okay because `prebuildify` can target (the headers of) older Node.js versions while itself running on a newer version.
2727

28-
We've yet to align Python versions ([#15](https://github.com/prebuild/docker-images/issues/15)). A next major will use Python 3.
29-
3028
Images that are based on [`dockcross`](https://github.com/dockcross/dockcross) (see below) may inadvertently introduce breaking changes because `dockcross` does not use semantic versions ([dockcross/dockcross#399](https://github.com/dockcross/dockcross/issues/399)) and does not maintain a changelog that would allow us to easily categorize changes and then tag our images accordingly. If this concerns you we recommend pinning to an exact version (`x.x.x`) which we treat as immutable.
3129

3230
## Images

alpine/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ FROM node:lts-alpine
22

33
RUN addgroup -g 2000 travis && \
44
adduser -u 2000 -G travis -s /bin/sh -D travis && \
5-
apk --no-cache add g++ gcc libgcc libstdc++ linux-headers make python git
5+
apk --no-cache add g++ gcc libgcc libstdc++ linux-headers make python3 git && \
6+
ln -sf python3 /usr/bin/python && \
7+
python --version
68

79
USER node
810

centos7-devtoolset7/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ USER 0
55
RUN groupadd -g 1000 node && useradd -g 1000 -u 1000 -m node && \
66
groupadd -g 2000 travis && useradd -g 2000 -u 2000 -m travis && \
77
curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash - && \
8-
yum install -y make nodejs && \
9-
npm -v
8+
yum install -y make nodejs python3 && \
9+
sed -i 's/#!\/usr\/bin\/python/#!\/usr\/bin\/python2/' /usr/bin/yum && \
10+
ln -sf python3 /usr/bin/python && \
11+
yum clean all && \
12+
rm -rf /var/cache/yum && \
13+
npm -v && \
14+
python --version
1015

1116
USER node
1217

0 commit comments

Comments
 (0)