mapbox / mapbox/node-or-tools

Usage/Installation on node-alpine

Aperta
#80 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C++
Stelle
155
Fork
47
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

We're using the node_or_tools since some time on the default docker node18 image (bullseye).

Now, to reduce the attack surface of the container, we wanted to switch to using the alpine variant of the node18 docker images.

But when it comes to installing the node_or_tools, this crashes with unclear reason:

00:03:16.940 Step 16/17 : RUN npm ci --prod --legacy-peer-deps
00:03:17.017  ---> Running in f462b65004b4
00:03:19.819 [91mnpm[0m[91m WARN [0m[91mconfig production Use `--omit=dev` instead.
00:03:19.820 [0m[91mnpm WARN EBADENGINE Unsupported engine {
00:03:22.269 [0m[91mnpm [0m[91mWARN[0m[91m EBADENGINE[0m[91m   package: '@apollo/federation@0.27.0',
00:03:22.270 npm[0m[91m WARN [0m[91mEBADENGINE[0m[91m   required: { node: '>=12.13.0 <17.0' },
00:03:22.270 npm WARN [0m[91mEBADENGINE   current: { node: 'v18.12.1', npm: '8.19.3' }
00:03:22.270 [0m[91mnpm WARN EBADENGINE[0m[91m }
00:03:22.270 [0m[91mnpm[0m[91m [0m[91mWARN[0m[91m [0m[91mdeprecated[0m[91m har-validator@5.1.5: this library is no longer supported
00:03:32.214 [0m[91mnpm[0m[91m [0m[91mWARN[0m[91m [0m[91mdeprecated[0m[91m graphql-extensions@0.15.0: The `graphql-extensions` API has been removed from Apollo Server 3. Use the plugin API instead: https://www.apollographql.com/docs/apollo-server/integrations/plugins/
00:03:32.721 [0m[91mnpm[0m[91m [0m[91mWARN[0m[91m [0m[91mdeprecated[0m[91m request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
00:03:33.723 [0m[91mnpm[0m[91m [0m[91mWARN[0m[91m [0m[91mdeprecated[0m[91m uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
00:03:33.794 [0m[91mnpm [0m[91mERR! code 1
00:04:09.899 [0m[91mnpm [0m[91mERR! path /home/node/node_modules/node_or_tools
00:04:09.900 [0m[91mnpm [0m[91mERR! command failed
00:04:09.905 [0m[91mnpm ERR![0m[91m command sh -c -- node-pre-gyp install --fallback-to-build
00:04:09.906 [0m[91mnpm[0m[91m ERR! make: Entering directory '/home/node/node_modules/node_or_tools/build'
00:04:09.906 [0m[91mnpm ERR![0m[91m   ACTION binding_gyp_action_before_build_target_install_deps mason_packages
00:04:09.906 [0m[91mnpm[0m[91m ERR![0m[91m make: Leaving directory '/home/node/node_modules/node_or_tools/build'
00:04:09.907 [0m[91mnpm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/node/node_modules/node_or_tools/lib/binding/node_or_tools.node --module_name=node_or_tools --module_path=/home/node/node_modules/node_or_tools/lib/binding --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
00:04:09.907 [0m[91mnpm [0m[91mERR! node-pre-gyp info it worked if it ends with ok
00:04:09.909 npm[0m[91m ERR! node-pre-gyp info using node-pre-gyp@1.0.10
00:04:09.910 npm[0m[91m ERR! node-pre-gyp info using node@18.12.1 | linux | x64
00:04:09.910 [0m[91mnpm[0m[91m ERR![0m[91m node-pre-gyp info check checked for "/home/node/node_modules/node_or_tools/lib/binding/node_or_tools.node" (not found)
00:04:09.910 npm ERR! node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/node_or_tools/v1.1.1/Release/node-v108-linux-x64.tar.gz
00:04:09.910 [0m[91mnpm ERR! node-pre-gyp ERR! install response status 403 Forbidden on https://mapbox-node-binary.s3.amazonaws.com/node_or_tools/v1.1.1/Release/node-v108-linux-x64.tar.gz 
00:04:09.910 npm ERR![0m[91m node-pre-gyp WARN Pre-built binaries not installable for node_or_tools@1.1.1 and node@18.12.1 (node-v108 ABI, musl) (falling back to source compile with node-gyp) 
00:04:09.910 npm[0m[91m ERR! node-pre-gyp WARN Hit error response status 403 Forbidden on https://mapbox-node-binary.s3.amazonaws.com/node_or_tools/v1.1.1/Release/node-v108-linux-x64.tar.gz 
00:04:09.911 npm ERR! gyp info it worked if it ends with ok
00:04:09.911 npm ERR![0m[91m gyp info using node-gyp@9.1.0
00:04:09.911 npm ERR! gyp info using node@18.12.1 | linux | x64
00:04:09.911 npm [0m[91mERR! gyp info ok 
00:04:09.911 [0m[91mnpm ERR! gyp info it worked if it ends with ok
00:04:09.911 npm[0m[91m ERR! gyp info using node-gyp@9.1.0
00:04:09.914 npm ERR! gyp info using node@18.12.1 | linux | x64
00:04:09.914 npm ERR! gyp info find Python using Python version 3.10.5 found at "/usr/bin/python3"
00:04:09.914 npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v18.12.1/node-v18.12.1-headers.tar.gz
00:04:09.914 npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v18.12.1/node-v18.12.1-headers.tar.gz
00:04:09.914 npm ERR! gyp http GET https://unofficial-builds.nodejs.org/download/release/v18.12.1/SHASUMS256.txt
00:04:09.914 npm ERR! gyp http 200 https://unofficial-builds.nodejs.org/download/release/v18.12.1/SHASUMS256.txt
00:04:09.914 npm ERR! gyp info spawn /usr/bin/python3
00:04:09.914 npm ERR! gyp info spawn args [
00:04:09.914 npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
00:04:09.914 npm ERR! gyp info spawn args   'binding.gyp',
00:04:09.914 npm ERR! gyp info spawn args   '-f',
00:04:09.914 npm ERR! gyp info spawn args   'make',
00:04:09.914 npm ERR! gyp info spawn args   '-I',
00:04:09.914 npm ERR! gyp info spawn args   '/home/node/node_modules/node_or_tools/build/config.gypi',
00:04:09.914 npm ERR! gyp info spawn args   '-I',
00:04:09.914 npm ERR! gyp info spawn args   '/home/node/node_modules/node_or_tools/common.gypi',
00:04:09.914 npm ERR! gyp info spawn args   '-I',
00:04:09.914 npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
00:04:09.914 npm ERR! gyp info spawn args   '-I',
00:04:09.914 npm ERR! gyp info spawn args   '/home/node/.cache/node-gyp/18.12.1/include/node/common.gypi',
00:04:09.914 npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
00:04:09.914 npm ERR! gyp info spawn args   '-Dvisibility=default',
00:04:09.914 npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/node/.cache/node-gyp/18.12.1',
00:04:09.914 npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
00:04:09.914 npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/node/.cache/node-gyp/18.12.1/<(target_arch)/node.lib',
00:04:09.914 npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/node/node_modules/node_or_tools',
00:04:09.914 npm[0m[91m ERR! gyp info spawn args   '-Dnode_engine=v8',
00:04:09.916 npm ERR! gyp info spawn args   '--depth=.',
00:04:09.916 npm ERR! gyp info spawn args   '--no-parallel',
00:04:09.916 npm ERR! gyp info spawn args   '--generator-output',
00:04:09.916 npm ERR! gyp info spawn args   'build',
00:04:09.916 npm ERR! gyp info spawn args   '-Goutput_dir=.'
00:04:09.916 npm ERR! gyp info spawn args ]
00:04:09.916 npm ERR! gyp info ok 
00:04:09.916 npm ERR! gyp info it worked if it ends with ok
00:04:09.916 npm ERR! gyp info using node-gyp@9.1.0
00:04:09.916 npm ERR! gyp info using node@18.12.1 | linux | x64
00:04:09.916 npm ERR! gyp info spawn make
00:04:09.916 npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
00:04:09.916 npm ERR! env: can't execute 'bash': No such file or directory
00:04:09.916 npm ERR! make: *** [action_before_build.target.mk:13: mason_packages] Error 127
00:04:09.916 npm ERR! gyp ERR! build error 
00:04:09.916 npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
00:04:09.916 npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
00:04:09.916 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
00:04:09.916 npm ERR![0m[91m gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
00:04:09.917 npm [0m[91mERR![0m[91m gyp ERR! System Linux 4.15.0-194-generic
00:04:09.917 npm[0m[91m [0m[91mERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/node/node_modules/node_or_tools/lib/binding/node_or_tools.node" "--module_name=node_or_tools" "--module_path=/home/node/node_modules/node_or_tools/lib/binding" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
00:04:09.917 [0m[91mnpm ERR! gyp ERR! cwd /home/node/node_modules/node_or_tools
00:04:09.919 npm ERR! gyp ERR! node -v v18.12.1
00:04:09.919 npm ERR! gyp ERR! node-gyp -v v9.1.0
00:04:09.919 npm ERR! gyp ERR! not ok 
00:04:09.919 npm ERR! node-pre-gyp ERR! build error 
00:04:09.919 npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/node/node_modules/node_or_tools/lib/binding/node_or_tools.node --module_name=node_or_tools --module_path=/home/node/node_modules/node_or_tools/lib/binding --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
00:04:09.919 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/node/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
00:04:09.919 npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
00:04:09.919 npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
00:04:09.919 npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
00:04:09.919 npm ERR! node-pre-gyp ERR! System Linux 4.15.0-194-generic
00:04:09.919 npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/home/node/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
00:04:09.919 npm ERR! node-pre-gyp ERR! cwd /home/node/node_modules/node_or_tools
00:04:09.919 npm ERR![0m[91m node-pre-gyp ERR! node -v v18.12.1
00:04:09.923 npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
00:04:09.923 npm ERR! node-pre-gyp ERR! not ok
00:04:09.923 [0m[91m
00:04:09.929 [0m[91mnpm ERR![0m[91m A complete log of this run can be found in:
00:04:09.931 npm ERR![0m[91m     /home/node/.npm/_logs/2022-11-09T11_17_33_641Z-debug-0.log
00:04:09.931 [0mThe command '/bin/sh -c npm ci --prod --legacy-peer-deps' returned a non-zero code: 1

Our node base image is built this way:

FROM node:18-alpine 

ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools

RUN apk add --update --no-cache make g++ libc6-compat

RUN apk add --update --no-cache openssl ca-certificates

RUN npm install -g npm@latest

So all things the node_or_tools needs to be build should be present.

For me it looks like the problem is, that access to the https://mapbox-node-binary.s3.amazonaws.com.... address isn't working and that this is finally causing the build to crash?

Please help, I'm a bit clueless...

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci il problema con l’immagine node:18-alpine mostrata e il comando npm ci. Esamina binding.gyp, common.gypi e il fallback di node-pre-gyp relativo all’URL S3 segnalata e all’assenza di bash; il lavoro è completato quando node_or_tools viene installato correttamente nell’immagine Alpine.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, docker, node.js
Ambito
build-system, devops
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.