Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit 72ab23d

Browse files
gdiggsAshley Baldwin-Hunter
authored andcommitted
Compile Node 5.x manually
Alpine doesn't have a package for this and we need to pin to a version
1 parent 1a258ed commit 72ab23d

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

Dockerfile

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,40 @@ COPY vendor/php-parser/composer.lock /usr/src/app/vendor/php-parser/
1010

1111
COPY package.json /usr/src/app/
1212

13-
RUN apk update && apk add nodejs python python3 php5-phar php5-openssl php5-cli php5-json php5-zlib php5-xml
14-
15-
RUN apk add curl && \
13+
RUN apk update && apk add python python3 php5-phar php5-openssl php5-cli php5-json php5-zlib php5-xml
14+
15+
ENV NODE_VERSION=v5.12.0 \
16+
NPM_VERSION=3
17+
18+
# Based on https://github.com/mhart/alpine-node
19+
RUN apk add --no-cache curl make gcc g++ linux-headers binutils-gold gnupg libstdc++ && \
20+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys \
21+
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
22+
FD3A5288F042B6850C66B31F09FE44734EB7990E \
23+
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
24+
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
25+
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
26+
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
27+
56730D5401028683275BD23C23EFEFE93C4CFFFE && \
28+
curl -sSLO https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}.tar.xz && \
29+
curl -sSL https://nodejs.org/dist/${NODE_VERSION}/SHASUMS256.txt.asc | gpg --batch --decrypt | \
30+
grep " node-${NODE_VERSION}.tar.xz\$" | sha256sum -c | grep . && \
31+
tar -xf node-${NODE_VERSION}.tar.xz && \
32+
cd node-${NODE_VERSION} && \
33+
./configure --prefix=/usr ${CONFIG_FLAGS} && \
34+
make -j$(getconf _NPROCESSORS_ONLN) && \
35+
make install && \
36+
cd / && \
37+
if [ -x /usr/bin/npm ]; then \
38+
npm install -g npm@${NPM_VERSION} && \
39+
find /usr/lib/node_modules/npm -name test -o -name .bin -type d | xargs rm -rf; \
40+
fi && \
41+
apk del curl make gcc g++ linux-headers binutils-gold gnupg ${DEL_PKGS} && \
42+
rm -rf ${RM_DIRS} /node-${NODE_VERSION}* /usr/share/man /tmp/* /var/cache/apk/* \
43+
/root/.npm /root/.node-gyp /root/.gnupg /usr/lib/node_modules/npm/man \
44+
/usr/lib/node_modules/npm/doc /usr/lib/node_modules/npm/html /usr/lib/node_modules/npm/scripts
45+
46+
RUN apk add --update curl && \
1647
gem install bundler --no-ri --no-rdoc && \
1748
bundle install -j 4 && \
1849
curl -sS https://getcomposer.org/installer | php && \

0 commit comments

Comments
 (0)