devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click! Two engines: chromium-based WEBJS and pure-websocket NOWEB
https://waha.devlike.pro/
Apache License 2.0
1.02k stars 310 forks source link

Can't run docker image - Illegal instruction (core dumped) #138

Open oxodi opened 1 year ago

oxodi commented 1 year ago

Hi,

when try run docker image i see this issue:

yarn run v1.22.19
$ node --unhandled-rejections=none dist/main
WAHA (WhatsApp HTTP API) - Running CORE version...
Illegal instruction (core dumped)
error Command failed with exit code 132.

Container stop and i can't run it.

How can i solve this issue?

allburov commented 1 year ago

Hi! What OS and docker engine version do you use? It should work on Ubuntu 22 and I remember facing the similar issue on Ubuntu 20

oxodi commented 1 year ago

Hi,

OS: Ubuntu 22.02 Docker Engine: 20.10.24 Installed using official Repo.

allburov commented 1 year ago

Could you try to build the image on your environment this way and see if it helps?

https://github.com/devlikeapro/whatsapp-http-api.git
cd whatsapp-http-api
docker build . -t devlikeapro/whatsapp-http-api

# run it as usual
docker run --rm -it -p 3000:3000 --name whatsapp-http-api devlikeapro/whatsapp-http-api

Probably we have some compiled modules in nodejs and github action runner's CPU is different from your CPU.

allburov commented 1 year ago

Actually, please try to pull the latest version, I've changed it a bit

allburov commented 1 year ago

this way

docker pull devlikeapro/whatsapp-http-api
oxodi commented 1 year ago

Hi,

building it made the same issue:

git clone https://github.com/devlikeapro/whatsapp-http-api.git
cd whatsapp-http-api/
docker build . -t devlikeapro/whatsapp-http-api
docker run --rm -it -p 3000:3000 --name whatsapp-http-api devlikeapro/whatsapp-http-api

yarn run v1.22.19
$ node --unhandled-rejections=none dist/main
WAHA (WhatsApp HTTP API) - Running CORE version...
Illegal instruction (core dumped)
error Command failed with exit code 132.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

same pulling the new docker image;

Try running npm install i see some dependencies unsatisfy, is this a problem?

oxodi commented 1 year ago

Running "yarn start" from the APP folder i see this:

Error Could not find TypeScript configuration file "tsconfig.json". Please, ensure that you are running this command in the appropriate directory (inside Nest workspace).

allburov commented 1 year ago

You should use yarn v2 version to build the project locally

yarn set version 3.6.1
yarn install

Is it your PC or some VPS in the cloud?

oxodi commented 1 year ago

it's an on-premise VPS, running on Proxmox.

I'm trying rebuild

oxodi commented 1 year ago

I made a new try and this is the result:

docker build . -t devlikeapro/whatsapp-http-api
[+] Building 744.1s (17/21)                                                                              docker:default
[+] Building 745.6s (17/21)                                                                              docker:default
[+] Building 746.1s (17/21)                                                                              docker:default
[+] Building 746.2s (17/21)                                                                              docker:default
[+] Building 746.4s (17/21)                                                                              docker:default
[+] Building 1067.0s (22/22) FINISHED                                                                    docker:default
 => [internal] load build definition from Dockerfile                                                               0.1s
 => => transferring dockerfile: 1.63kB                                                                             0.0s
 => [internal] load .dockerignore                                                                                  0.1s
 => => transferring context: 498B                                                                                  0.0s
 => [internal] load metadata for docker.io/library/node:20-bullseye                                                1.8s
 => [internal] load build context                                                                                  0.1s
 => => transferring context: 623.89kB                                                                              0.1s
 => [release 1/8] FROM docker.io/library/node:20-bullseye@sha256:3f7ce4fe38a590f2b64da2676107ac2d93375cba8593e91  56.9s
 => => resolve docker.io/library/node:20-bullseye@sha256:3f7ce4fe38a590f2b64da2676107ac2d93375cba8593e9157464132e  0.0s
 => => sha256:3f7ce4fe38a590f2b64da2676107ac2d93375cba8593e9157464132e9398fbd1 1.21kB / 1.21kB                     0.0s
 => => sha256:b33664cdb637449226d11ed8bb3b34d8d78f8435ee253421b41a56af2675c899 2.00kB / 2.00kB                     0.0s
 => => sha256:6a75f7d66b6230f7fd52317976c88ebd5436fc6eebaac04940457bb634571f41 7.23kB / 7.23kB                     0.0s
 => => sha256:fa786a946ae67fa18e07eaf82fefee1777449f7db1a8fea5abec1aadbe99e2ef 54.59MB / 54.59MB                   5.1s
 => => sha256:34df401c391c7595044379e04e8ad4856a5a3974cdbf5a160f0a204d761e88aa 55.06MB / 55.06MB                   4.1s
 => => sha256:6fdd0e5b72ccae203ec30d533c0bcd34200af90265e0531c66356812e529af32 15.76MB / 15.76MB                   2.2s
 => => sha256:f3f8721393bc605f2b915d80eb2ad6d5219db374f36bbd1fee99b99174a0a4ca 196.85MB / 196.85MB                13.5s
 => => sha256:7993ee3beeaf7062cdca2873b3dfeaf0c3c4a54109a5a1d4cb1209b61ee457a8 4.20kB / 4.20kB                     4.6s
 => => extracting sha256:34df401c391c7595044379e04e8ad4856a5a3974cdbf5a160f0a204d761e88aa                         12.9s
 => => sha256:3487b2c6bc6a7cc9f887049e9b9d15452bbbcc6d13b0dd65bfd71ef2768ac510 47.49MB / 47.49MB                   8.0s
 => => sha256:b5a8c8f526578d299f2666e2ae5816d0b27619e79a75729de4ad1a38a3bcb804 2.27MB / 2.27MB                     5.7s
 => => sha256:9051fd04eb6e9bc1a01830d199287eca9088088a64cef28c08c577b9241838d4 451B / 451B                         6.0s
 => => extracting sha256:6fdd0e5b72ccae203ec30d533c0bcd34200af90265e0531c66356812e529af32                          1.1s
 => => extracting sha256:fa786a946ae67fa18e07eaf82fefee1777449f7db1a8fea5abec1aadbe99e2ef                          7.5s
 => => extracting sha256:f3f8721393bc605f2b915d80eb2ad6d5219db374f36bbd1fee99b99174a0a4ca                         20.4s
 => => extracting sha256:7993ee3beeaf7062cdca2873b3dfeaf0c3c4a54109a5a1d4cb1209b61ee457a8                          0.0s
 => => extracting sha256:3487b2c6bc6a7cc9f887049e9b9d15452bbbcc6d13b0dd65bfd71ef2768ac510                          6.4s
 => => extracting sha256:b5a8c8f526578d299f2666e2ae5816d0b27619e79a75729de4ad1a38a3bcb804                          0.3s
 => => extracting sha256:9051fd04eb6e9bc1a01830d199287eca9088088a64cef28c08c577b9241838d4                          0.0s
 => [build  2/10] WORKDIR /src                                                                                     2.6s
 => [release 2/8] RUN apt-get update      && apt-get install -y fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai  37.8s
 => [build  3/10] COPY package.json .                                                                              0.3s
 => [build  4/10] COPY yarn.lock .                                                                                 0.4s
 => [build  5/10] RUN yarn set version 3.6.1                                                                       7.4s
 => [build  6/10] RUN yarn install                                                                               637.8s
 => [release 3/8] RUN if [ "chromium" = "chromium" ]; then         apt-get update          && apt-get update     129.6s
 => [release 4/8] RUN if [ "chromium" = "chrome" ]; then         apt-get update          && apt-get install -y wg  1.9s
 => [release 5/8] WORKDIR /app                                                                                     0.5s
 => [release 6/8] COPY package.json ./                                                                             0.6s
 => [build  7/10] WORKDIR /src                                                                                     0.7s
 => [build  8/10] ADD . /src                                                                                       0.6s
 => [build  9/10] RUN yarn install                                                                                97.0s
 => [build 10/10] RUN yarn build && find ./dist -name "*.d.ts" -delete                                            66.2s
 => [release 7/8] COPY --from=build /src/node_modules ./node_modules                                              77.6s
 => [release 8/8] COPY --from=build /src/dist ./dist                                                               0.9s
 => exporting to image                                                                                            62.9s
 => => exporting layers                                                                                           62.6s
 => => writing image sha256:8d7186092d3e77f7b565667a89697ffba6b1773e3ed991d9138622c8ea5c0c51                       0.1s
 => => naming to docker.io/devlikeapro/whatsapp-http-api                                                           0.2s
docker run --rm -it -p 3000:3000 --name whatsapp-http-api devlikeapro/whatsapp-http-api
yarn run v1.22.19
$ node --unhandled-rejections=none dist/main
WAHA (WhatsApp HTTP API) - Running CORE version...
Illegal instruction (core dumped)
error Command failed with exit code 132.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
allburov commented 1 year ago

@oxodi is there anyother PC or Max where you can test it?

It's so weird that even local build didn't help you, I'm sorry :( I'll try to update all packages to see how it goes a bit later

oxodi commented 1 year ago

I've tryed in 2 dirrent VPS;

Don't worry, if i can help finding a solution let me known, i don't know how to check for helping you

oxodi commented 1 year ago

I try in a cloud VPS (Hetzner) and it works correctly; The fact is really strange, the VM use the same Image ( Ubuntu 22) and the same Docker version, i miss some steps ?

allburov commented 1 year ago

CPU must be different and one doesn't have certain instructions. I'll dig into the problem later, wanna test it on different VPS

oxodi commented 1 year ago

If this is helpful for you, try running manually in Verbose Mode, i see this:


root@8b5c5e7856ce:/app/dist# yarn start
yarn run v1.22.19
$ nest start

 Error  Could not find TypeScript configuration file "tsconfig.json". Please, ensure that you are running this command in the appropriate directory (inside Nest workspace).

Done in 2.56s.
root@8b5c5e7856ce:/app/dist# yarn --verbose start
yarn run v1.22.19
verbose 0.381477326 Checking for configuration file "/app/.npmrc".
verbose 0.382605968 Checking for configuration file "/usr/local/share/.npmrc".
verbose 0.383387902 Checking for configuration file "/usr/local/etc/npmrc".
verbose 0.384448737 Checking for configuration file "/root/.npmrc".
verbose 0.385345327 Checking for configuration file "/app/.npmrc".
verbose 0.387343612 Checking for configuration file "/app/.yarnrc".
verbose 0.388078981 Checking for configuration file "/usr/local/share/.yarnrc".
verbose 0.388751858 Checking for configuration file "/usr/local/etc/yarnrc".
verbose 0.389350124 Checking for configuration file "/root/.yarnrc".
verbose 0.389805875 Checking for configuration file "/app/.yarnrc".
verbose 0.396536944 current time: 2023-07-17T15:40:38.386Z
$ nest start

 Error  Could not find TypeScript configuration file "tsconfig.json". Please, ensure that you are running this command in the appropriate directory (inside Nest workspace).

Done in 1.68s.
root@8b5c5e7856ce:/app/dist# yarn --verbose start:prod
yarn run v1.22.19
verbose 0.378760777 Checking for configuration file "/app/.npmrc".
verbose 0.379824289 Checking for configuration file "/usr/local/share/.npmrc".
verbose 0.380362526 Checking for configuration file "/usr/local/etc/npmrc".
verbose 0.381132552 Checking for configuration file "/root/.npmrc".
verbose 0.381722548 Checking for configuration file "/app/.npmrc".
verbose 0.383307491 Checking for configuration file "/app/.yarnrc".
verbose 0.384027006 Checking for configuration file "/usr/local/share/.yarnrc".
verbose 0.384799732 Checking for configuration file "/usr/local/etc/yarnrc".
verbose 0.385430737 Checking for configuration file "/root/.yarnrc".
verbose 0.385991187 Checking for configuration file "/app/.yarnrc".
verbose 0.392905015 current time: 2023-07-17T15:40:44.458Z
$ node --unhandled-rejections=none dist/main
WAHA (WhatsApp HTTP API) - Running CORE version...
Illegal instruction (core dumped)
verbose 2.178815376 Error: Command failed with exit code 132.
    at ProcessTermError.ExtendableBuiltin (/opt/yarn-v1.22.19/lib/cli.js:721:66)
    at ProcessTermError.MessageError (/opt/yarn-v1.22.19/lib/cli.js:750:123)
    at new ProcessTermError (/opt/yarn-v1.22.19/lib/cli.js:790:113)
    at /opt/yarn-v1.22.19/lib/cli.js:34406:30
    at Generator.throw (<anonymous>)
    at step (/opt/yarn-v1.22.19/lib/cli.js:310:30)
    at /opt/yarn-v1.22.19/lib/cli.js:323:13
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
error Command failed with exit code 132.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
devlikepro commented 5 months ago

Do you still have this problem with the latest build?

patron:PRO