Docker build fails because of old `node` version used
In README.md
, instructions for Docker are:
docker build -t opl .
docker run -p 8000:8000 opl
Running this with Docker version 26.1.1, build 4cf5afaz
on Macbook Pro M3, I get following error:
58.87 Compiling server v0.1.0 (/opt/openpowerlifting/server)
125.4 Finished `release` profile [optimized] target(s) in 1m 24s
125.5 cp ../target/release/server "build/server"
125.5 make -C client
125.5 make[2]: Entering directory '/opt/openpowerlifting/server/client'
125.5 rm -rf build
125.5 mkdir -p 'build'
125.5 mkdir -p 'build/css'
125.5 mkdir -p 'build/images'
125.5 mkdir -p 'build/images/openipf'
125.5 mkdir -p 'build/scripts'
125.5 if [ ! -d "node_modules" ]; then npm install; fi
125.8 npm WARN npm npm does not support Node.js v10.24.0
125.8 npm WARN npm You should probably upgrade to a newer version of node as we
125.8 npm WARN npm can't make any promises that npm will work with this version.
125.8 npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
125.8 npm WARN npm You can find the latest version at https://nodejs.org/
126.0 npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
126.5 npm WARN tar write after end
126.5 npm WARN notice [SECURITY] semver has the following vulnerability: 1 moderate. Go here for more details: https://github.com/advisories?query=semver - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
126.5 npm WARN notice [SECURITY] webpack has the following vulnerability: 1 critical. Go here for more details: https://github.com/advisories?query=webpack - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
126.7 npm WARN tar write after end
126.9 npm WARN notice [SECURITY] loader-utils has the following vulnerabilities: 1 critical, 2 high. Go here for more details: https://github.com/advisories?query=loader-utils - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
127.2 npm WARN notice [SECURITY] terser has the following vulnerability: 1 high. Go here for more details: https://github.com/advisories?query=terser - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
127.4 npm WARN notice [SECURITY] semver has the following vulnerability: 1 moderate. Go here for more details: https://github.com/advisories?query=semver - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
127.6 npm WARN notice [SECURITY] loader-utils has the following vulnerabilities: 1 critical, 2 high. Go here for more details: https://github.com/advisories?query=loader-utils - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
127.7 npm WARN notice [SECURITY] json5 has the following vulnerability: 1 high. Go here for more details: https://github.com/advisories?query=json5 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
127.7 npm WARN notice [SECURITY] json5 has the following vulnerability: 1 high. Go here for more details: https://github.com/advisories?query=json5 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
127.7 npm WARN notice [SECURITY] minimist has the following vulnerability: 1 critical. Go here for more details: https://github.com/advisories?query=minimist - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
127.7 npm WARN notice [SECURITY] jquery-ui has the following vulnerability: 1 moderate. Go here for more details: https://github.com/advisories?query=jquery-ui - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
127.8 npm WARN notice [SECURITY] @babel/traverse has the following vulnerability: 1 critical. Go here for more details: https://github.com/advisories?query=%40babel%2Ftraverse - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
127.9 npm WARN notice [SECURITY] semver has the following vulnerability: 1 moderate. Go here for more details: https://github.com/advisories?query=semver - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
129.4 npm ERR! cb() never called!
129.4
129.4 npm ERR! This is an error with npm itself. Please report this error at:
129.4 npm ERR! <https://github.com/npm/npm/issues>
129.5
129.5 npm ERR! A complete log of this run can be found in:
129.5 npm ERR! /root/.npm/_logs/2024-05-07T23_40_02_204Z-debug.log
129.5 make[2]: Leaving directory '/opt/openpowerlifting/server/client'
129.5 make[2]: *** [Makefile:11: npminit] Error 1
129.5 make[1]: *** [Makefile:39: client] Error 2
129.5 make[1]: Leaving directory '/opt/openpowerlifting/server'
129.5 make: *** [Makefile:33: server] Error 2
------
Dockerfile:42
--------------------
40 |
41 | # Build it
42 | >>> RUN make
43 |
44 | # Move to our server
--------------------
ERROR: failed to solve: process "/bin/sh -c make" did not complete successfully: exit code: 2
This is because the version of node.js that it's using is v10.24.0, very old.
The resolution is to use a newer version of node when installing. There's already a commented out line:
#curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
in the Dockerfile
, perhaps just that?