Error while building Docker Image

Hey folks,

I am getting the below error while building my docker image for my rescript project. Has anyone faced a similar issue before?

=> ERROR [13/15] RUN yarn bs:build                                                                                                                                                                    1.4s
 > [13/15] RUN yarn bs:build:
#18 1.079 yarn run v1.22.17
#18 1.246 $ rescript build -with-deps
#18 1.399 Dependency on @rescript/react
#18 1.403 /node_modules/rescript/linux/ninja.exe: error while loading shared libraries: cannot open shared object file: No such file or directory
#18 1.403 Failure: /node_modules/rescript/linux/ninja.exe
#18 1.403 Location: /node_modules/@rescript/react/lib/bs
#18 1.390 error Command failed with exit code 2.
#18 1.391 info Visit for documentation about this command.

As you can see from the error snippet above, the above issue comes when the command yarn bs: build runs, which is essentially rescript build -with-deps (Refer to the docker file below)

help/suggestions would be appreciated.


below is the snippet of my docker file

    FROM node:12-alpine

    LABEL maintainer=""

    RUN apk --update add bash vim git python3 g++ make gcc musl-dev m4 libgcc libstdc++ ncurses-libs

    RUN ln -s /usr/bin/python3 /usr/bin/python

    # To make re-formality ppx work
    RUN wget -q -O /etc/apk/keys/

    RUN wget

    RUN apk add glibc-2.30-r0.apk


    # Copy package.json, so that yarn install will only do a fresh installation of node modules if package.json is modified

    ADD package.json .

    ADD yarn.lock .


    RUN echo -e "machine\nlogin Prateek13727\npassword $GITHUB_READ_TOKEN" > ~/.netrc

    RUN yarn install --ignore-engines --frozen-lockfile

    RUN rm ~/.netrc

    ADD . ./

    RUN yarn bs:build

    RUN yarn build:$ENV

    # Expose the app port

    EXPOSE 3003

    COPY deploy/scripts/* /usr/bin/

    ENTRYPOINT ["bash", "/usr/bin/"]

Sorry I don’t have any solutions for you, but could this be related?

There is also this recent thread: How to speed up ReScript in CI Server?


Sounds like it, yeah, thanks for the link. Taking the suggestions above, I just used a Debian based image, and whammo, it went from 25 minutes to 3. Given I suck at Docker, I was impressed.

1 Like