lyswhut / lx-music-sync-server

运行在Node.js上的LX Music数据同步服务
Apache License 2.0
524 stars 145 forks source link

Dockerfile在arm64v8平台下打包报错 #39

Open leiax00 opened 1 year ago

leiax00 commented 1 year ago
root@lax-pi:/self/code/github/lx-music-sync-server# docker build -t 10.1.0.7:5000/leiax00/lx-music-sync-server-arm:1.3.1 .
[+] Building 46.4s (8/12)                                                                                                                                                                      
 => [internal] load .dockerignore                                                                                                                                                         5.8s
 => => transferring context: 63B                                                                                                                                                          0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                      6.5s
 => => transferring dockerfile: 793B                                                                                                                                                      0.1s
 => [internal] load metadata for docker.io/library/node:16-alpine                                                                                                                         3.5s
 => [internal] load build context                                                                                                                                                         0.3s
 => => transferring context: 3.96kB                                                                                                                                                       0.0s
 => [builder 1/5] FROM docker.io/library/node:16-alpine@sha256:6c381d5dc2a11dcdb693f0301e8587e43f440c90cdb8933eaaaabb905d44cdb9                                                           0.0s
 => CACHED [builder 2/5] WORKDIR /server                                                                                                                                                  0.1s
 => CACHED [builder 3/5] COPY . .                                                                                                                                                         0.0s
 => ERROR [builder 4/5] RUN npm install                                                                                                                                                  34.3s
------                                                                                                                                                                                         
 > [builder 4/5] RUN npm install:                                                                                                                                                              
#0 30.69 npm notice                                                                                                                                                                            
#0 30.69 npm notice New major version of npm available! 8.19.4 -> 9.8.1                                                                                                                        
#0 30.69 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.8.1>                                                                                                                
#0 30.69 npm notice Run `npm install -g npm@9.8.1` to update!                                                                                                                                  
#0 30.69 npm notice 
#0 30.70 npm ERR! code 1
#0 30.70 npm ERR! path /server/node_modules/bufferutil
#0 30.71 npm ERR! command failed
#0 30.71 npm ERR! command sh -c -- node-gyp-build
#0 30.71 npm ERR! gyp info it worked if it ends with ok
#0 30.71 npm ERR! gyp info using node-gyp@9.1.0
#0 30.71 npm ERR! gyp info using node@16.20.1 | linux | arm64
#0 30.71 npm ERR! gyp ERR! find Python 
#0 30.71 npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
#0 30.71 npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
#0 30.71 npm ERR! gyp ERR! find Python checking if "python3" can be used
#0 30.71 npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
#0 30.71 npm ERR! gyp ERR! find Python checking if "python" can be used
#0 30.71 npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
#0 30.71 npm ERR! gyp ERR! find Python 
#0 30.71 npm ERR! gyp ERR! find Python **********************************************************
#0 30.71 npm ERR! gyp ERR! find Python You need to install the latest version of Python.
#0 30.71 npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#0 30.71 npm ERR! gyp ERR! find Python you can try one of the following options:
#0 30.71 npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#0 30.71 npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
#0 30.71 npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
#0 30.71 npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
#0 30.71 npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
#0 30.71 npm ERR! gyp ERR! find Python For more information consult the documentation at:
#0 30.71 npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#0 30.71 npm ERR! gyp ERR! find Python **********************************************************
#0 30.71 npm ERR! gyp ERR! find Python 
#0 30.71 npm ERR! gyp ERR! configure error 
#0 30.71 npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
#0 30.71 npm ERR! gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
#0 30.71 npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
#0 30.71 npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
#0 30.71 npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
#0 30.71 npm ERR! gyp ERR! stack     at exithandler (node:child_process:410:5)
#0 30.71 npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:422:5)
#0 30.71 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
#0 30.71 npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
#0 30.71 npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:485:16)
#0 30.71 npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
#0 30.71 npm ERR! gyp ERR! System Linux 5.15.0-1033-raspi
#0 30.71 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
#0 30.71 npm ERR! gyp ERR! cwd /server/node_modules/bufferutil
#0 30.71 npm ERR! gyp ERR! node -v v16.20.1
#0 30.71 npm ERR! gyp ERR! node-gyp -v v9.1.0
#0 30.71 npm ERR! gyp ERR! not ok
#0 30.72 
#0 30.72 npm ERR! A complete log of this run can be found in:
#0 30.72 npm ERR!     /root/.npm/_logs/2023-07-21T07_43_25_118Z-debug-0.log
------
Dockerfile:5
--------------------
   3 |     COPY . .
   4 |     # RUN npm install
   5 | >>> RUN npm install
   6 |     RUN npm run build
   7 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c npm install" did not complete successfully: exit code: 1
Shea11012 commented 1 year ago

RUN apk add --update --no-cache build-base python3 在两个阶段都添加这一行就可以了