worklenz icon indicating copy to clipboard operation
worklenz copied to clipboard

docker compose / docker build failure linked to worklenz-backend

Open steelec opened this issue 1 year ago • 8 comments
trafficstars

Hi, very interested in trying this out but ran into some issues this afternoon:

  • docker compose ( #10 ) fails on step 2 (snippet included below) while building the backend:
Step 2/8 : RUN npm install -g ts-node typescript grunt grunt-cli
 ---> Running in 3fbe17ca45b6
node[7]: ../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.
 1: 0xb9a330 node::Abort() [node]
 2: 0xb9a3ae  [node]
 3: 0xc084be  [node]
 4: 0xc085a1 node::NodePlatform::NodePlatform(int, v8::TracingController*, v8::PageAllocator*) [node]
 5: 0xb56253 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]
 6: 0xb568ab node::Start(int, char**) [node]
 7: 0x786aaf7f124a  [/lib/x86_64-linux-gnu/libc.so.6]
 8: 0x786aaf7f1305 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
 9: 0xad58ae _start [node]
Aborted (core dumped)
The command '/bin/sh -c npm install -g ts-node typescript grunt grunt-cli' returned a non-zero code: 134
ERROR: Service 'backend' failed to build : Build failed
  • Following this up with a direct docker build command on worklenz-backend results in the same error.
    • from within the repo, reproduce with: docker build -t worklenz-backend worklenz-backend/ --no-cache
    • switching to the more recent node.js 20 image as base in the Dockerfile does not resolve the issue
    • switching to 18-alpine or 20-alpine means that additional apk dependencies would need to be installed
      • I did not chase this all the way to the end, but can if this information would be useful.
Sending build context to Docker daemon   14.2MB
Step 1/9 : FROM node:20
 ---> a740756586cb
Step 2/9 : WORKDIR /usr/src/app
 ---> Running in 5bbc6aa61764
Removing intermediate container 5bbc6aa61764
 ---> b55c863d2060
Step 3/9 : RUN npm install -g ts-node typescript grunt grunt-cli
 ---> Running in dee45f93d7e4

  #  node[7]: std::unique_ptr<long unsigned int> node::WorkerThreadsTaskRunner::DelayedTaskScheduler::Start() at ../src/node_platform.cc:68
  #  Assertion failed: (0) == (uv_thread_create(t.get(), start_thread, this))

----- Native stack trace -----

 1: 0xcba0f7 node::Assert(node::AssertionInfo const&) [node]
 2: 0xd3942e node::WorkerThreadsTaskRunner::WorkerThreadsTaskRunner(int) [node]
 3: 0xd3950c node::NodePlatform::NodePlatform(int, v8::TracingController*, v8::PageAllocator*) [node]
 4: 0xc6e2d6  [node]
 5: 0xc6f7d4 node::Start(int, char**) [node]
 6: 0x74ac9f11824a  [/lib/x86_64-linux-gnu/libc.so.6]
 7: 0x74ac9f118305 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
 8: 0xbc5c8e _start [node]
Aborted (core dumped)

steelec avatar May 21 '24 19:05 steelec

Hi @steelec , Can you try to add following line before the npm install RUN apt-get update || : && apt-get install python3 make g++ -y || rm -rf /var/cache/apk/*

Nadeera3784 avatar May 22 '24 06:05 Nadeera3784

thanks for the quick response - unfortunately it also core dumps sudo docker build -t worklenz-backend worklenz-backend/

Sending build context to Docker daemon   14.2MB
Step 1/10 : FROM node:18
 ---> ae2638f0dbe7
Step 2/10 : WORKDIR /usr/src/app
 ---> Using cache
 ---> 97a30df4da61
Step 3/10 : RUN apt-get update || : && apt-get install python3 make g++ -y || rm -rf /var/cache/apk/*
 ---> Using cache
 ---> 6aaece657bee
Step 4/10 : RUN npm install -g ts-node typescript grunt grunt-cli
 ---> Running in 0a29a721ad5e
node[7]: ../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.
 1: 0xb9a330 node::Abort() [node]
 2: 0xb9a3ae  [node]
 3: 0xc084be  [node]
 4: 0xc085a1 node::NodePlatform::NodePlatform(int, v8::TracingController*, v8::PageAllocator*) [node]
 5: 0xb56253 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]
 6: 0xb568ab node::Start(int, char**) [node]
 7: 0x72e3792ab24a  [/lib/x86_64-linux-gnu/libc.so.6]
 8: 0x72e3792ab305 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
 9: 0xad58ae _start [node]
Aborted (core dumped)
The command '/bin/sh -c npm install -g ts-node typescript grunt grunt-cli' returned a non-zero code: 134

steelec avatar May 22 '24 13:05 steelec

Hi @steelec , Could you please provide the Docker version and the operating system you are currently using? By the way, I just tried this on Ubuntu and encountered the same error. However, after modifying it as follows, it worked.

# Use the official Node.js 18 image as a base
FROM node:18

# Create and set the working directory
WORKDIR /usr/src/app

# Install global dependencies

RUN apt-get update || : && apt-get install python3 make g++ -y || rm -rf /var/cache/apk/*

RUN npm install -g ts-node typescript grunt grunt-cli

RUN npm install -g grunt-cli bower

# Copy package.json and package-lock.json (if available)
COPY package*.json ./

# Install app dependencies
RUN npm install

# Copy the rest of the application code
COPY . .

# Run the build script to compile TypeScript to JavaScript
RUN npm run build

# Expose the port the app runs on
EXPOSE 3000

# Start the application
CMD ["npm", "start"]

Nadeera3784 avatar May 22 '24 13:05 Nadeera3784

Having a similar problem running docker-compose.

docker compose -f docker-compose.yml up
(...)
unable to prepare context: path "/worklenz/worklenz-frontend" not found

include avatar May 23 '24 17:05 include

Hi, @include Are you trying run this on root directory?
Better to build it first and then run it. for example :

docker compose build 
docker compose up

Nadeera3784 avatar May 23 '24 23:05 Nadeera3784

You can use #17 and get up and running in a few minutes.

aperera avatar May 24 '24 04:05 aperera

Hi @steelec , Could you please provide the Docker version and the operating system you are currently using? By the way, I just tried this on Ubuntu and encountered the same error. However, after modifying it as follows, it worked.

Thanks @Nadeera3784 , I think this ended up being a version / plugin issue. I re-followed the installation guidelines here to get the latest version and I was able to run compose without an issue: https://docs.docker.com/engine/install/

You may want to add this to your documentation to ensure that the latest version is installed. Based on this and your experience, it vanilla Ubuntu install may need to have the apt repo added and docker + plugins installed manually.

steelec avatar May 28 '24 13:05 steelec

I've merged #20. The compose build and up functions are working as expected.

chamikaJ avatar May 31 '24 10:05 chamikaJ