educative.io

Error while building multi stage builds

root@educative:~/atsea-sample-shop-app/app# docker image build -t multi:stage .
Sending build context to Docker daemon 3.658MB
Step 1/19 : FROM node:latest AS storefront
—> 725940b2828c
Step 2/19 : WORKDIR /usr/src/atsea/app/react-app
—> Using cache
—> dddde99aeaf5
Step 3/19 : COPY react-app .
—> Using cache
—> 87ff0e65dbdb
Step 4/19 : RUN npm install
—> Running in aa102df9ce33
node[6]: …/src/node_platform.cc:68:std::unique_ptr node::WorkerThreadsTaskRunner::DelayedTaskScheduler::Start(): Assertion `(0) == (uv_thread_create(t.get(), start_thread, this))’ failed.
1: 0xc98550 node::Abort() [node]
2: 0xc985ce [node]
3: 0xd16979 node::WorkerThreadsTaskRunner::WorkerThreadsTaskRunner(int) [node]
4: 0xd16a9c node::NodePlatform::NodePlatform(int, v8::TracingController*, v8::PageAllocator*) [node]
5: 0xc53f13 [node]
6: 0xc5487b node::Start(int, char**) [node]
7: 0x7ffa3cf921ca [/lib/x86_64-linux-gnu/libc.so.6]
8: 0x7ffa3cf92285 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
9: 0xbaffee _start [node]
Aborted (core dumped)
The command ‘/bin/sh -c npm install’ returned a non-zero code: 134
root@educative:~/atsea-sample-shop-app/app#

Hello,

This issue is because of the fact that this course is old and as we are working to revamp this course, you can try following solution:

1- Run:
git clone https://github.com/nigelpoulton/atsea-sample-shop-app.git
2- Then:
cd atsea-sample-shop-app/app
3- Before running docker build command give command:
cat > Dockerfile
4- Press Enter and in the next line, enter a new code for Dockerfile, specifying the version of images used:
’ FROM node:15 AS storefront

WORKDIR /usr/src/atsea/app/react-app

COPY react-app .

RUN npm install

RUN npm run build

FROM maven:3.5.2-jdk-8-alpine AS appserver

WORKDIR /usr/src/atsea

COPY pom.xml .

RUN mvn -B -f pom.xml -s /usr/share/maven/ref/settings-docker.xml dependency:resolve

COPY . .

RUN mvn -B -s /usr/share/maven/ref/settings-docker.xml package -DskipTests

FROM java:8-jdk-alpine

RUN adduser -Dh /home/gordon gordon

WORKDIR /static

COPY --from=storefront /usr/src/atsea/app/react-app/build/ .

WORKDIR /app

COPY --from=appserver /usr/src/atsea/target/AtSea-0.0.1-SNAPSHOT.jar .

ENTRYPOINT [“java”, “-jar”, “/app/AtSea-0.0.1-SNAPSHOT.jar”]

CMD ["–spring.profiles.active=postgres"]’

5- Now run the docker image build -t multi:stage . command.

Hope this helps!

Regards,
Team Educative.