Skip to content

Flow-bin exiting with ENOENT in alpine docker container #3649

@mightyguava

Description

@mightyguava

I have flow working just fine in a project running locally on a Mac, but trying to run this on the official Node alpine base image is not working. Error and minimal repro steps pasted below.

I think #1605 fixes compilation of flow in a docker container, and I'm able to build a working flow binary following instructions there, but it'd be nice if the yarn installed flow could either "just work", or only requiring installing some os-dependencies, versus building flow from scratch.

Error with yarn installed flow

# Start a container
docker run -ti --rm node:7.8.0-alpine sh
# Now in container
mkdir test
cd test
yarn init
yarn add flow flow-bin --dev
yarn run flow

Errors:

yarn run v0.21.3
$ "/test/node_modules/.bin/flow"
events.js:163
      throw er; // Unhandled 'error' event
      ^

Error: spawn /test/node_modules/flow-bin/flow-linux64-v0.42.0/flow ENOENT
    at exports._errnoException (util.js:1034:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:607:11)
    at run (bootstrap_node.js:423:7)
    at startup (bootstrap_node.js:147:9)
    at bootstrap_node.js:538:3
error Command failed with exit code 1.

workaround (partial): To build flow in alpine node, in case this is useful to anyone

FROM node:7.7.2-alpine
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
  && echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
  && apk --no-cache add \
     alpine-sdk \
     ocaml \
     ocamlbuild \
     libelf \
     libelf-dev \
     ncurses \
     inotify-tools \
     linux-headers \
     git \
     bash \
     diffutils \
  && git clone --depth 1 https://github.com/facebook/flow.git /tmp/flow \
  && cd /tmp/flow \
  && make \
  && cp bin/flow /usr/bin/flow \
  && apk --no-cache del \
     alpine-sdk \
     ocaml \
     ocamlbuild \
     libelf-dev \
     ncurses \
     inotify-tools \
     linux-headers \
     git \
     bash \
     diffutils \
  && cd / \
  && rm -rf /tmp/flow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions