jack3898 / discord-youtube-bot-2

A powerful Discord YouTube Bot.
0 stars 0 forks source link

docker-compose fails, complaining about python #20

Closed melchoir55 closed 1 year ago

melchoir55 commented 1 year ago

Did nothing other than clone the repo and docker-compose up --build

Here is the output:

~/gitrepos/discord-youtube-bot-2$ docker-compose up --build
Building bot
Sending build context to Docker daemon  626.2kB

Step 1/7 : FROM node:16-alpine
 ---> 51405b97d471
Step 2/7 : ENV NODE_ENV production
 ---> Using cache
 ---> 2299f3d27ef5
Step 3/7 : WORKDIR /home/node
 ---> Using cache
 ---> 9ab078b6396b
Step 4/7 : COPY --chown=node:node . .
 ---> Using cache
 ---> 2c901250b21b
Step 5/7 : USER node
 ---> Using cache
 ---> f8bd12b07060
Step 6/7 : RUN npm i
 ---> Running in d0b15d2cc579
npm ERR! code 1
npm ERR! path /home/node/node_modules/@discordjs/opus
npm ERR! command failed
npm ERR! command sh -c -- node-pre-gyp install --fallback-to-build
npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-x64-musl-1.2.3/opus.node --module_name=opus --module_path=/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-x64-musl-1.2.3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@0.4.2
npm ERR! node-pre-gyp info using node@16.18.0 | linux | x64
npm ERR! node-pre-gyp info check checked for "/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-x64-musl-1.2.3/opus.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/discordjs/opus/releases/download/v0.5.3/opus-v0.5.3-node-v93-napi-v3-linux-x64-musl-1.2.3.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/discordjs/opus/releases/download/v0.5.3/opus-v0.5.3-node-v93-napi-v3-linux-x64-musl-1.2.3.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for @discordjs/opus@0.5.3 and node@16.18.0 (node-v93 ABI, musl) (falling back to source compile with node-gyp) 
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/discordjs/opus/releases/download/v0.5.3/opus-v0.5.3-node-v93-napi-v3-linux-x64-musl-1.2.3.tar.gz 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@16.18.0 | linux | x64
npm ERR! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@16.18.0 | linux | x64
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
npm ERR! gyp ERR! stack     at exithandler (node:child_process:410:5)
npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:422:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:485:16)
npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Linux 5.4.0-107-generic
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-x64-musl-1.2.3/opus.node" "--module_name=opus" "--module_path=/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-x64-musl-1.2.3" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
npm ERR! gyp ERR! cwd /home/node/node_modules/@discordjs/opus
npm ERR! gyp ERR! node -v v16.18.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok 
npm ERR! node-pre-gyp ERR! build error 
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 configure --fallback-to-build --module=/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-x64-musl-1.2.3/opus.node --module_name=opus --module_path=/home/node/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-x64-musl-1.2.3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/node/node_modules/@discordjs/node-pre-gyp/lib/util/compile.js:85:20)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1100:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
npm ERR! node-pre-gyp ERR! System Linux 5.4.0-107-generic
npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/home/node/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /home/node/node_modules/@discordjs/opus
npm ERR! node-pre-gyp ERR! node -v v16.18.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.4.2
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2022-10-20T06_10_29_621Z-debug-0.log
The command '/bin/sh -c npm i' returned a non-zero code: 1
ERROR: Service 'bot' failed to build
riflowth commented 1 year ago

@melchoir55 You need the build tools for node-gyp so just add this line in the dockerfile RUN apk add python3 make gcc g++ before installing the module dependencies

I suggest you separate the build stage to reduce the output image size caused from these build tools.