简体   繁体   中英

docker build on ubuntu vs linux aarch64

I'm building a docker container on Linux aarch64 debian. The build fails missing python.

But the exact same Dockerfile builds fine on Ubuntu latest (github actions). What am I missing from the host machine or - how does the host affect what docker can build? I don't understand. They're both Linux boxes.

[4/4] Building fresh packages...
warning Error running install script for optional dependency: "/pirkts/node_modules/usb: Command failed.
Exit code: 1
Command: node-gyp-build
Arguments:
Directory: /pirkts/node_modules/usb
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@16.14.0 | linux | arm64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if \"python3\" can be used
gyp ERR! find Python - \"python3\" is not in PATH or produced an error
gyp ERR! find Python checking if \"python\" can be used
gyp ERR! find Python - \"python\" is not in PATH or produced an error
gyp ERR! find Python checking if \"python2\" can be used
gyp ERR! find Python - \"python2\" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python=\"/path/to/pythonexecutable\"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python \"/path/to/pythonexecutable\"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:302:47)
gyp ERR! stack     at PythonFinder.runChecks (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:136:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:179:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:266:16)
gyp ERR! stack     at exithandler (node:child_process:406:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:418:5)
gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:478:16)
gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
gyp ERR! System Linux 5.10.0-11-cloud-arm64
gyp ERR! command \"/usr/local/bin/node\" \"/pirkts/node_modules/.bin/node-gyp\" \"rebuild\"
gyp ERR! cwd /pirkts/node_modules/usb
gyp ERR! node -v v16.14.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok"
info This module is OPTIONAL, you can safely ignore this error
info This module is OPTIONAL, you can safely ignore this error
warning Error running install script for optional dependency: "/pirkts/node_modules/@ledgerhq/hw-transport-node-hid-noevents/node_modules/node-hid: Command failed.
Exit code: 1
Command: prebuild-install --runtime napi || node-gyp rebuild
Arguments:
Directory: /pirkts/node_modules/@ledgerhq/hw-transport-node-hid-noevents/node_modules/node-hid
Output:
prebuild-install WARN install No prebuilt binaries found (target=3 runtime=napi arch=arm64 libc= platform=linux)
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@16.14.0 | linux | arm64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if \"python3\" can be used
gyp ERR! find Python - \"python3\" is not in PATH or produced an error
gyp ERR! find Python checking if \"python\" can be used
gyp ERR! find Python - \"python\" is not in PATH or produced an error
gyp ERR! find Python checking if \"python2\" can be used
gyp ERR! find Python - \"python2\" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python=\"/path/to/pythonexecutable\"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python \"/path/to/pythonexecutable\"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:302:47)
gyp ERR! stack     at PythonFinder.runChecks (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:136:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:179:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:266:16)
gyp ERR! stack     at exithandler (node:child_process:406:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:418:5)
gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:478:16)
gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
gyp ERR! System Linux 5.10.0-11-cloud-arm64
gyp ERR! command \"/usr/local/bin/node\" \"/pirkts/node_modules/.bin/node-gyp\" \"rebuild\"
gyp ERR! cwd /pirkts/node_modules/@ledgerhq/hw-transport-node-hid-noevents/node_modules/node-hid
gyp ERR! node -v v16.14.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok"
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error /pirkts/node_modules/utf-8-validate: Command failed.
Exit code: 1
Command: node-gyp-build
Arguments:
Directory: /pirkts/node_modules/utf-8-validate
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@16.14.0 | linux | arm64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:302:47)
gyp ERR! stack     at PythonFinder.runChecks (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:136:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:179:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:266:16)
gyp ERR! stack     at exithandler (node:child_process:406:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:418:5)
gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:478:16)
gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
gyp ERR! System Linux 5.10.0-11-cloud-arm64
gyp ERR! command "/usr/local/bin/node" "/pirkts/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /pirkts/node_modules/utf-8-validate
gyp ERR! node -v v16.14.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
warning Error running install script for optional dependency: "/pirkts/node_modules/node-hid: Command failed.
Exit code: 1
Command: prebuild-install || node-gyp rebuild
Arguments:
Directory: /pirkts/node_modules/node-hid
Output:
prebuild-install WARN install No prebuilt binaries found (target=16.14.0 runtime=node arch=arm64 libc= platform=linux)
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@16.14.0 | linux | arm64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if \"python3\" can be used
gyp ERR! find Python - \"python3\" is not in PATH or produced an error
gyp ERR! find Python checking if \"python\" can be used
gyp ERR! find Python - \"python\" is not in PATH or produced an error
gyp ERR! find Python checking if \"python2\" can be used
gyp ERR! find Python - \"python2\" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python=\"/path/to/pythonexecutable\"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python \"/path/to/pythonexecutable\"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:302:47)
gyp ERR! stack     at PythonFinder.runChecks (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:136:21)
gyp ERR! stack     at PythonFinder.<anonymous> (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:179:16)
gyp ERR! stack     at PythonFinder.execFileCallback (/pirkts/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/find-python.js:266:16)
gyp ERR! stack     at exithandler (node:child_process:406:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:418:5)
gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:478:16)
gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
gyp ERR! System Linux 5.10.0-11-cloud-arm64
gyp ERR! command \"/usr/local/bin/node\" \"/pirkts/node_modules/.bin/node-gyp\" \"rebuild\"
gyp ERR! cwd /pirkts/node_modules/node-hid
gyp ERR! node -v v16.14.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok"

Cheers

edit 1:

debian host:

FROM node:16-buster-slim as node
RUN apt-get update -y && apt-get install -y git python make gcc libudev-dev libusb-1.0-0-dev g++ pkg-config

FROM alpine as downloader
ARG SOLC_PREFIX=https://github.com/ethereum/solc-bin/raw/gh-pages/linux-amd64/solc-linux-amd64

ADD ${SOLC_PREFIX}-v0.4.11+commit.68ef5810 ./solc-v0.4.11+commit.68ef5810

FROM node as builder

WORKDIR /pirkts
COPY *.json yarn.lock ./
COPY packages/utils/package.json ./packages/utils/package.json
RUN yarn install --frozen-lockfile
FROM node

WORKDIR /pirkts

COPY --from=builder /pirkts/node_modules ./node_modules
COPY *.json yarn.lock ./
RUN yarn build

CMD ["true"]

ubuntu latest host:

FROM node:16-buster-slim as node
RUN apt-get update -y && apt-get install -y git

FROM alpine as downloader
ARG SOLC_PREFIX=https://github.com/ethereum/solc-bin/raw/gh-pages/linux-amd64/solc-linux-amd64

ADD ${SOLC_PREFIX}-v0.4.11+commit.68ef5810 ./solc-v0.4.11+commit.68ef5810

FROM node as builder

WORKDIR /pirkts
COPY *.json yarn.lock ./
COPY packages/utils/package.json ./packages/utils/package.json
RUN yarn install --frozen-lockfile
FROM node

WORKDIR /pirkts

COPY --from=builder /pirkts/node_modules ./node_modules
COPY *.json yarn.lock ./
RUN yarn build

CMD ["true"]

As you can observe, the apt-get install list when on a debian host needs to be a lot bigger than on a ubuntu host. I'm trying to understand why... On a debian host if I don't provide python make gcc libudev-dev libusb-1.0-0-dev g++ pkg-config the docker-compose build fails.

I think the host CPU type affects the pre-builds that are available to the docker guest container. Because ARM pre-builds don't exist it tries to build them and it uses python (which doesn't exist in the Dockerfile example above - hence it fails).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM