GitLab Docker build locked on sharp download (timeout)

Viewed 515

During Docker build in Gitlab job pipeline the process is freezed on

After 1 hour buil is killed by timeout.

Dockerfile:

FROM node:14.17.0

WORKDIR /app

ARG NODE_ENV=dev

ENV NODE_ENV $NODE_ENV

ENV PORT 3005

COPY ["package.json", "tsconfig.json", "./"]

RUN npm install --unsafe-perm
COPY ./src ./src
COPY ./views ./views
RUN npm run build
EXPOSE $PORT

CMD ["npm","start"]

I tryed build docker on my Windows environment whitout problem.

1 Answers

That looks like lovell/sharp issue 2611

Workaround:

In case you cannot upgrade, change this line in node_modules/sharp/binding.gyp:

'-std=c++0x',

To:

'-std=c++14',

And run npm rebuild

Actual solution: upgrade.

I force the resolution on package.json to use the new version of Sharp and I could install and run, however my node-sass blow due the Node 16.
I remove the sharp resolution and downgrade the image in the gitlab CI Docker to node:14

Everything works fine now, so it seems was an issue with Node instead of Sharp.


The OP Pid confirms in the comments having resolved the issue by updating the host OS Ubuntu (20.04).
But that lead to lovell/sharp issue 2817, which in turn requires GitLab support.

Related