2

I want to dockerise my angular application, but I get the following error while building the Dockerfile.

My Dockerfile:

FROM node:alpine as build-step
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
RUN npm run build

FROM nginx:alpine as prod-stage
COPY --from=build-step /app/dist/angular-app /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

Error log:

executor failed running [/bin/sh -c npm run build]: exit code: 1
2
  • What is the definition of "build" in your package.json? And you could debug this by changing the Dockerfile: Take only the first stage and use a CMD like "sleep 100d". Then you can enter the container and enter the run-build interactively. Commented Sep 7, 2021 at 18:20
  • @leonms, have you resolved this issue, if yes please share us as well, bex I am also facing the same error, as its runs from last 3 month , today suddenly it give error "failed to solve: executor failed running [/bin/sh -c npm install --production --silent && mv node_modules ../]: exit code: 1" Commented Jun 7, 2022 at 10:24

2 Answers 2

3

I've faced a similar issue, but it was faced completing the Java guide in the Docker documentation. Originally, I was having this issue while working in the Intellij terminal and also from the Windows CLI. Even after completing the steps from the link provided at the end of this comment, the Intellij terminal would not do the job. I noticed two error codes; exit code: 1 & exit code: 127. Both referred to a "no such file or directory" error. I fixed the issue in the Visual Studio Code terminal by completing the step at the following link. Now my Docker image, builds using the docker build --tag java-docker . command, even in Intellij. Please reference the following link please click here

Sign up to request clarification or add additional context in comments.

Comments

0

I've seen the same error message when I dockerise a web app served in Parcel. In my case, my package.json simply didn't have build script.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.