RocketChat / Docker.Official.Image

Docker hub - community managed image
308 stars 216 forks source link

It doesn't build on arm64 architecture due to Node.js Fibers package #48

Open shawnguo2 opened 6 years ago

shawnguo2 commented 6 years ago

Hi,

I'm trying to do an arm64 native build of rocket.chat docker image. The problem I'm facing is that there is a prebuilt Fibers package for x64, but it has to be built from source on arm64. However, the build fails with -slim node image from which some tools like python are missing.

It can be successfully built with changing base image from node:8.9-slim to node:8.9 in Dockerfile.

fibers@2.0.0 install /app/bundle/programs/server/node_modules/fibers node build.js || nodejs build.js make: Entering directory '/app/bundle/programs/server/node_modules/fibers/build' CXX(target) Release/obj.target/fibers/src/fibers.o CXX(target) Release/obj.target/fibers/src/coroutine.o CC(target) Release/obj.target/fibers/src/libcoro/coro.o SOLINK_MODULE(target) Release/obj.target/fibers.node COPY Release/fibers.node make: Leaving directory '/app/bundle/programs/server/node_modules/fibers/build' Installed in /app/bundle/programs/server/node_modules/fibers/bin/linux-arm64-57/fibers.node

But is it the correct fix? Thanks.

Shawn

tianon commented 6 years ago

I'm not the image maintainer here, but IMO it'd be better to figure out what packages are necessary and install just those -- the difference between node:8.11-slim and node:8.11 is pretty significant:

$ docker images 'node:8.11*'
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
node                8.11-slim           1d5555ef5229        3 weeks ago         182MB
node                8.11                ed145ef978c4        3 weeks ago         673MB

I imagine the necessary build dependencies could probably even be added and subsequently removed in the same RUN line to save even more space on the arm64v8 build (to ensure it's got rough size parity with amd64). I think the hard part is going to be determining which architectures we need to install the build dependencies on, but perhaps that'd be fine to be a hard-coded list for now?

lag-linaro commented 5 years ago

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