node.jsjenkinsserveryarnpkg

Docker build failure in Jenkins Ubuntu


I am not sure if I should be asking this question here but I am giving it a try.

I have Dockerfile that looks like the following. Some parts of it are omitted here for brevity.

# Stage 1: Install Dependencies
FROM node:18.19.1 AS dependencies

WORKDIR /app

# Install dependencies
RUN yarn config set strict-ssl false && yarn global add @angular/cli@19.1.0

Whe ever a yarn command is ran, I for example, on the step: RUN yarn config set strict-ssl false && yarn global add @angular/cli@19.1.0

I am getting the following error

Digest: sha256:b39895225fb1984139d5af76400aff8fac3dd5bc00dd41a3ce22fc8a6cf538d5
Status: Downloaded newer image for node:18.19.1
 ---> 9489b43a1afc
Step 2/27 : WORKDIR /app
 ---> Running in 7484fe9b74ce
Removing intermediate container 7484fe9b74ce
 ---> 6a42dd0aa757
Step 3/27 : RUN yarn config set strict-ssl false && yarn global add @angular/cli@16.2.8
 ---> Running in 1d3439efdc5f
[91mnode[8]: ../src/node_platform.cc:68:std::unique_ptr<long unsigned int> node::WorkerThreadsTaskRunner::DelayedTaskScheduler::Start(): Assertion `(0) == (uv_thread_create(t.get(), start_thread, this))' failed.
[0m[91m 1: 0xb95be0 node::Abort() [node]
[0m[91m 2: 0xb95c5e  [node]
[0m[91m 3: 0xc045ae  [node]
[0m[91m 4: 0xc04691 node::NodePlatform::NodePlatform(int, v8::TracingController*, v8::PageAllocator*) [node]
[0m[91m 5: 0xb50e63 node::InitializeOncePerProcess(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, node::ProcessFlags::Flags) [node]
[0m[91m 6: 0xb514bb node::Start(int, char**) [node]
 7: 0x7f13fc22c24a  [/lib/x86_64-linux-gnu/libc.so.6]
 8: 0x7f13fc22c305 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
[0m[91m 9: 0xacfdce _start [node]
[0m[91mAborted (core dumped)
[0mThe command '/bin/sh -c yarn config set strict-ssl false && yarn global add @angular/cli@16.2.8' returned a non-zero code: 134
[Pipeline] echo
Failed to Build Docker Image 

I want to use node version 18.19.1 as as the base image. But I have also tried versions: ^20.11.1 || >=22.0.0"

The Yarn version is: v1.22.19

The Docker version on the Jenkins server is: Docker version 19.03.12.

The output of ulimit -a follows

core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 192387
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 393216
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 131072
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

What's causing this issue?


Solution

  • My solution to this issue was to use the node:18.19-bullseye-slim base image.

    The Angular application is not dependent on any low level system tools or resources. So this works perfectly for now without having to fiddle with the build server.

    Side note:

    In cases when I'd need low level tools or resources from the actual server, for example if I want to build for SSR or run automated tests using Cypress or some image processing using sharp for example, then I'd consider installing the specific tools required for example python, make, gcc, or g++ using a command along the line: apt-get install -y python3 make g++

    Or find a way to get the build to work with the full node:18.19.1 image - that would require fiddling with the build server though.

    ps: This SO issue is still open to other views. Thanks