Running expo from docker

hey folks.

does anyone have a guide or a working docker file, I’d like to tighten my build process and get out from under the dependency hell, one of the ways I normally do that is make the build happen inside a container.

when I try with exp (expo 16.0 and exp 40.0.2)

I see the following error

[exp] Starting React Native packager...
[exp] child_process.js:504
[exp]     throw err;
[exp]     ^
[exp]
[exp] Error: spawnSync /usr/src/app/node_modules/react-native/local-cli/setup_env.sh Unknown system error -8
[exp]     at exports._errnoException (util.js:1018:11)
[exp]     at spawnSync (child_process.js:459:20)
[exp]     at Object.execFileSync (child_process.js:496:13)
[exp]     at Object.run (/usr/src/app/node_modules/react-native/local-cli/cliEntry.js:136:16)

any ideas? suggestions?

1 Like

Hi! Can you share the Dockerfile you’re using? Most people run into issues with docker networking using the devtools, but I haven’t seen the RN packager fail to spawn a process before.

The same issue:

[exp] Making sure project is set up correctly...
[exp] Your project looks good!
[exp] Using project at /code
[exp] Starting React Native packager...
[exp] child_process.js:504
[exp]     throw err;
[exp]     ^
[exp] 
[exp] Error: spawnSync /code/node_modules/react-native/local-cli/setup_env.sh Unknown system error -8
[exp]     at exports._errnoException (util.js:1050:11)
[exp]     at spawnSync (child_process.js:459:20)
[exp]     at Object.execFileSync (child_process.js:496:13)
[exp]     at Object.run (/code/node_modules/react-native/local-cli/cliEntry.js:136:16)
[exp]     at Object.<anonymous> (/code/node_modules/react-native/local-cli/cli.js:23:12)
[exp]     at Module._compile (module.js:571:32)
[exp]     at Object.Module._extensions..js (module.js:580:10)
[exp]     at Module.load (module.js:488:32)
[exp]     at tryModuleLoad (module.js:447:12)
[exp]     at Function.Module._load (module.js:439:3)

My Dockerfie:

FROM node:7.10.0-alpine
RUN mkdir -p /code
WORKDIR /code

RUN npm set progress=false && \
    npm install -g exp
RUN exp login --username devops --password password
CMD [ "exp", "start", "--send-to", "ealebed@gmail.com" ]

EXPOSE 19000

I run container by this command:

docker run -d -p 19000:19000 -v /srv/node-expo/vocabulary-develop:/code registry.gitlab.lc:5000/mobile/vocabulary/node-exp:latest

If I run expo on my local machine (not in docker) all works fine…

I switch from alpine linux to node:6 and it worked, so I think the problem is with the minimal alpine linux.

You are right, with node:7.10.0 all works fine!
Thank you!

Hooray! Glad to hear it.

Just thought I would add, since I spent quite a while trying to figure this one out, expo seems to run fine on the node:alpine builds normally, but there are some dependencies that cause everything to fail. The sentry-expo dependency is the one that caused my build to fail. Same on the node:slim build. Changing to the standard Node docker build seems to work. It’s huge and bloated, but the expo fail messages are too cryptic to figure out why it is failing.

Thought I would chip in here as well. This doesn’t seem to be an expo issue, I was running into it as well but on a bare react-native project, no expo.