0

I have an angular production build running in a docker container and I would like to run the ng build and ng lint asynchronously.

I saw this answer which means my command would look like ng build --prod & ng lint. The problem is that if the first command fails before the second command finishes, my execution keeps running. (ex: The lint bombs after 10s because of a missed semicolon, but the build finishes after 6 minutes successfully. My command says it was successful even though my lint failed and continues to publish). My solution around this is to have ng build --prod && ng lint but this takes more time to finish.

Is there a way to have both commands run asynchronously and if one of the executions bomb out then the whole command stops?

9
  • did you explore github.com/mysticatea/npm-run-all/blob/HEAD/docs/npm-run-all.md Commented May 19, 2021 at 16:19
  • You'd generally run those commands in your Dockerfile, not in a standalone container. A RUN command will fail the image build if it exits with a failing status. Commented May 19, 2021 at 16:29
  • @AakashGarg that is exactly what I'm looking for. If you want to submit it as an answer, I will accept it in a couple hours to see if there is a solution that doesn't involve a 3rd party library. Commented May 19, 2021 at 16:36
  • @DavidMaze I am running ENTRYPOINT in my Dockerfile which runs a script from my package.json that lints and build everything for me. My RUN basically sets up a linux environment for me to build in. Commented May 19, 2021 at 16:38
  • That rebuilds your application every time you launch the container, and especially when you're talking about multi-minute builds that seems incredibly inefficient. Commented May 19, 2021 at 17:00

1 Answer 1

1

Please go for something like :-

https://github.com/mysticatea/npm-run-all/blob/HEAD/docs/npm-run-all.md

It gives you various options which will be usefull in all current and future scenarios.

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

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.