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: libstdc++.so.6: 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 https://yarnpkg.com/en/docs/cli/run 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.

Cheers
Prateek

below is the snippet of my docker file

    FROM node:12-alpine

    LABEL maintainer="prateekpandey@porter.in"

    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/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub

    RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.30-r0/glibc-2.30-r0.apk

    RUN apk add glibc-2.30-r0.apk

    ARG ENV

    # 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 .

    ARG GITHUB_READ_TOKEN

    RUN echo -e "machine github.com\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/run.sh"]

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?

2 Likes

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