SoTrxII / Pandora

A discord recording bot
ISC License
15 stars 10 forks source link

Dockerfile will not build #10

Open nt3rp opened 3 days ago

nt3rp commented 3 days ago

Problem When trying to run the Pandora application, the Docker image cannot be built.

Steps to Reproduce

  1. git clone the latest release v2.5.2
    • The problem is also present in the latest version of master
  2. cp .env.example to samples/minimal and rename to .env
  3. Add your Discord bot token as PANDORA_TOKEN
  4. cd samples/minimal; docker compose up

Expected Pandora, along with a redis instance and cooking instance should be running.

Actual An error occurs while trying to yarn install:

Error ``` docker compose up [+] Building 0.0s (0/1) [+] Building 0.2s (2/3) docker:default => [pandora internal] load build definition from Dockerfile => => transferring dockerfile: 933B [+] Building 0.4s (2/3) docker:default => [pandora internal] load build definition from Dockerfile => => transferring dockerfile: 933B [+] Building 19.9s (11/14) docker:default => [pandora internal] load build definition from Dockerfile => => transferring dockerfile: 933B => [pandora internal] load metadata for docker.io/library/node:18-alpine => [pandora auth] library/node:pull token for registry-1.docker.io => [pandora internal] load .dockerignore => => transferring context: 116B => [pandora internal] load build context => => transferring context: 7.35kB => [pandora build 1/7] FROM docker.io/library/node:18-alpine@sha256:7e43a2d633d91e8655a6c0f45d2ed987 => CACHED [pandora build 2/7] WORKDIR /app => CACHED [pandora build 3/7] RUN apk add python3 make alpine-sdk yarn => CACHED [pandora build 4/7] COPY . /app/ => CACHED [pandora build 5/7] RUN yarn set version berry && grep -qF 'nodeLinker' .yarnrc.yml || ec => ERROR [pandora build 6/7] RUN yarn install ------ > [pandora build 6/7] RUN yarn install: 0.587 ➀ YN0087: Migrated your project to the latest Yarn version πŸš€ 0.587 0.589 ➀ YN0000: Β· Yarn 4.5.3 0.598 ➀ YN0000: β”Œ Resolution step 4.408 ➀ YN0085: β”‚ + typescript@patch:typescript@npm%3A5.0.3#optional!builtin::version=5.0.3&hash=b5f058, and 2 more. 4.408 ➀ YN0085: β”‚ - fsevents@patch:fsevents@npm%3A2.3.2#~builtin::version=2.3.2&hash=18f3a7, and 2 more. 4.419 ➀ YN0000: β”” Completed in 3s 821ms 4.420 ➀ YN0000: β”Œ Post-resolution validation 4.420 ➀ YN0086: β”‚ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details. 4.421 ➀ YN0000: β”” Completed 4.421 ➀ YN0000: β”Œ Fetch step 12.39 ➀ YN0013: β”‚ 663 packages were added to the project (+ 41.06 MiB). 12.39 ➀ YN0000: β”” Completed in 7s 966ms 12.42 ➀ YN0000: β”Œ Link step 16.59 ➀ YN0007: β”‚ @discordjs/opus@npm:0.9.0 must be built because it never has been before or the last one failed 16.59 ➀ YN0007: β”‚ bufferutil@npm:4.0.7 must be built because it never has been before or the last one failed 16.59 ➀ YN0007: β”‚ zlib-sync@npm:0.1.8 must be built because it never has been before or the last one failed 16.59 ➀ YN0007: β”‚ restana@npm:4.9.4 must be built because it never has been before or the last one failed 16.59 ➀ YN0007: β”‚ protobufjs@npm:6.11.2 must be built because it never has been before or the last one failed 18.47 ➀ YN0009: β”‚ zlib-sync@npm:0.1.8 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-5830599b/build.log) 18.88 ➀ YN0009: β”‚ @discordjs/opus@npm:0.9.0 couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-40ff01b3/build.log) 18.88 ➀ YN0000: β”” Completed in 6s 463ms 18.91 ➀ YN0000: Β· Failed with errors in 18s 325ms ------ failed to solve: process "/bin/sh -c yarn install" did not complete successfully: exit code: 1 ```
nt3rp commented 3 days ago

I've done a bit of investigation, and have managed to figure out a few pieces but not the whole problem:

node:18-alpine doesn't ship with disttools The image used for the Dockerfile ships with python3, which doesn't include disttools, which is used by gyp, which is a dependency of zlib-sync and opus. In my testing, fixing that was a matter of adding py-setuptools to lines 5 and 15 of the Dockerfile

Incorrect version of yarn used After getting past that, I was running into issues with yarn. I don't have a log handy, but it was something like, "packageManager requires yarn@4.x (from package.json) but currently using 1.22.22" (which I was able to confirm).

I think the solution to that is to run corepack enable before installing yarn, as it seemed to resolve the issue.

Problems with yarn After that I hit a roadblock that I haven't figured out as I'm not super familiar with yarn. It's either:

(I'll try to dig in deeper but wanted to file this bug report in case there are known fixesβ€”or if someone more familiar with the project is able to fix it faster)