RocketChat / Docker.Official.Image

Docker hub - community managed image
295 stars 218 forks source link

It fails to run on arm64 architecture because of sharp.node #49

Open shawnguo2 opened 6 years ago

shawnguo2 commented 6 years ago

Hi,

With the "fix" mentioned in issue #48, I can successfully build rocket.chat image on arm64 architecture. But when trying to run the image, I got the following exception caused by sharp.node.

$ docker run --name rocketchat -p 80:3000 --env ROOT_URL=http://localhost --link db:db rocket.chat
Note: you are using a pure-JavaScript implementation of bcrypt.
While this implementation will work correctly, it is known to be
approximately three times slower than the native implementation.
In order to use the native implementation instead, run

  meteor npm install --save bcrypt

in the root directory of your application.
Will load cache for users
0 records load from users
Will load cache for rocketchat_room
0 records load from rocketchat_room
Will load cache for rocketchat_subscription
0 records load from rocketchat_subscription
Will load cache for rocketchat_settings
373 records load from rocketchat_settings
Updating process.env.MAIL_URL
Starting Email Intercepter...
Will load cache for rocketchat_permissions
0 records load from rocketchat_permissions
Will load cache for rocketchat_roles
0 records load from rocketchat_roles
Exception in callback of async function: Error: /app/bundle/programs/server/npm/node_modules/sharp/build/Release/sharp.node: cannot open shared object file: No such file or directory
    at Object.Module._extensions..node (module.js:681:18)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/app/bundle/programs/server/npm/node_modules/sharp/lib/constructor.js:10:15)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/app/bundle/programs/server/npm/node_modules/sharp/lib/index.js:3:15)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at npmRequire (/app/bundle/programs/server/npm-require.js:133:10)
    at Module.useNode (packages/modules-runtime.js:697:18)
    at fileEvaluate (packages/modules-runtime.js:342:20)
    at require (packages/modules-runtime.js:238:16)
    at FileUpload.js (packages/rocketchat:file-upload/server/lib/FileUpload.js:1:351)
    at fileEvaluate (packages/modules-runtime.js:343:9)
    at require (packages/modules-runtime.js:238:16)
    at /app/bundle/programs/server/packages/rocketchat_file-upload.js:2252:1
    at /app/bundle/programs/server/packages/rocketchat_file-upload.js:2266:3
    at /app/bundle/programs/server/boot.js:411:36
    at Array.forEach (<anonymous>)
    at /app/bundle/programs/server/boot.js:220:19
    at /app/bundle/programs/server/boot.js:471:5
    at Function.run (/app/bundle/programs/server/profile.js:510:12)
    at /app/bundle/programs/server/boot.js:470:11

The cause is that this sharp.node in meteor bundle is an x86-64 executable file.

$ file bundle/programs/server/npm/node_modules/sharp/build/Release/sharp.node
bundle/programs/server/npm/node_modules/sharp/build/Release/sharp.node: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=f0b3b64efe073fbfdd69b6a2778eb95102b58431, stripped

It seems that we should build this sharp package from source rather than always having a x86-64 binary in there? Thanks.

Shawn

khasim commented 6 years ago

@Sing-Li @tianon @pierreozoux - apologies for adding you directly. Is it possible to get your inputs on supporting official binaries for Rocket.chat for ARMv8 ? Let us know how we can help in this project.

Thanks.

Khasim

pierreozoux commented 6 years ago

@khasim no problems! I don't have much experience with that. I guess you have to fix the way the bundle is built.

Here is the bundle: https://github.com/RocketChat/Docker.Official.Image/blob/master/Dockerfile#L20

The bundle is built there: https://github.com/RocketChat/Rocket.Chat/blob/develop/.travis.yml#L57

I guess you need to add a flag to build it for arm archi.

This is a PR that fix arm support for snap packages, maybe that helps? https://github.com/RocketChat/Rocket.Chat/pull/11268/files

Good luck, and feel free to PR when you have a fix, so that you are not the only one maitaining it :)

axeII commented 5 years ago

Any update on this? I would love to run rocketchat container on arm64/arm64v8 architecture. 🙏

lag-linaro commented 5 years ago

Working on this now. PR to follow.

lag-linaro commented 5 years ago

FYI: https://github.com/RocketChat/Docker.Official.Image/pull/60

lag-linaro commented 5 years ago

Suggest changing the title to "Provide support for AArch64 (ARM64)".