I successfully build a docker image with the resin-cli inside a couple of months ago.
However, I tried again recently and it does not work. Using RUN npm install resin-cli -g --production --unsafe-perm raises the following error:
../deps/e2fsprogs/lib/ext2fs/getsectsize.c:34:22: fatal error: linux/fd.h: No such file or directory
#include <linux/fd.h>
I checked that this is a dependency project which recently changed. However, I can install the resin-cli doing the following:
use docker run to run a /bin/bash terminal inside the container that I am building
then, use npm install resin-cli -g --production. That is, without --unsafe-perm. That does not work. It reach to an infinite try-exception with the following errors:
gyp WARN EACCES user "nobody" does not have permission to access the dev dir "/usr/lib/node_modules/resin-cli/node_modules/ext2fs/.node-gyp/8.9.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/resin-cli/node_modules/ext2fs/.node-gyp"
However, if I manually stop the command at this point, and run again npm install resin-cli -g --production --unsafe-perm it works!
This is not a solution, because I cannot write a Dockerfile with this sequence of steps, but I hope it is enough information for you to debug this issue
I didn’t find the fd.h file neither before and after trying to install (and stop) npm install resin-cli -g --production.
I checked that the dependency ext2fs is the one which fails. Moreover, if I try to install npm install ext2fs the error is the same. It is strange because when I run step 2 (try to install resin-cli and stop), I can install resin-cli, but I can’t ext2fs. It seems that some kind of checking by resin-cli continues the installation, but I don’t know if the behaviour would be totally correct.
I attach you my Dockerfile just in case I’m missing something:
FROM docker
RUN apk --update --no-cache add bash git openssh python python3 g++ make nodejs nodejs-npm yarn
RUN npm install resin-cli -g --production --unsafe-perm
Ok I found the problem. In this linux distribution there is a dependency (linux-headers) which must be installed: apk add linux-headers. This solved the problem.
However it seems there is something more. It seems that it successfully installed the resin-cli tool, but when I use resin deploy MyAppName it fails:
Error relocating /usr/lib/node_modules/resin-cli/node_modules/resin-image-fs/node_modules/ext2fs/build/Release/bindings.node: ext2fs_open_file: symbol not found
Do you know what the problem would be? Anyway I am searching and trying to guess what’s the problem here.
Do you still have this issue? If so, can you please create an issue in https://github.com/resin-io/resin-cli/issues/new with the context that is mention in this thread (i.e. the error messages) so that we can take it from there?
I’m trying to use this with CircleCi. With the resincli image docker our build environment will be much smaller enabling faster buildtimes. For example we’re using https://github.com/znly/docker-protobuf/blob/master/Dockerfile for optimizing protobuf/grpc use, optimized its 22mb
first of all thank you for your work and your time! I am sorry for my late response, but I couldn’t test it before.
Probably I am missing something, but If I first install npm i ext2fs@1.0.7 and then npm install --unsafe-perm --global --production resin-cli@7.7.0, it seems it works, but fails when I try to use the resin tool. For example, if I use resin local scan, it throws this error:
Error relocating /usr/local/lib/node_modules/resin-cli/node_modules/ext2fs/build/Release/bindings.node: ext2fs_open_file: symbol not found
I tried the Dockerfile that @ohlsont wrote but the error is the same.
@jcozar do you still have this issue?
I just created a Dockerfile based on the examples above and I can build and run resin-cli:
Dockerfile:
FROM docker
RUN apk --update --no-cache add bash git openssh python python3 g++ make nodejs nodejs-npm yarn linux-headers
RUN npm install resin-cli -g --production --unsafe-perm
$ docker build . -t resin-cli
Sending build context to Docker daemon 6.144kB
Step 1/3 : FROM docker
---> 9797f6e6a068
Step 2/3 : RUN apk --update --no-cache add bash git openssh python python3 g++ make nodejs nodejs-npm yarn linux-headers
---> Using cache
---> b671bd58ac9b
Step 3/3 : RUN npm install resin-cli -g --production --unsafe-perm
---> Using cache
---> 51bc22c304c9
Successfully built 51bc22c304c9
Successfully tagged resin-cli:latest
$ docker run resin-cli resin local scan
Reporting scan results
Could not find any resinOS devices in the local network
If you need help, don't hesitate in contacting us at:
GitHub: https://github.com/resin-io/resin-cli/issues/new
Forums: https://forums.balena.io