Build Failed - Building Images through CodeBuild and Pushing them on ECR.

0

I am having a codepipeline with codebuild which builds and pushes my docker image to ECR. I also have another pipeline for running docker images in EC2/ECS.

The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.
The command '/bin/sh -c npm run build' returned a non-zero code: 1

Command did not exit successfully docker build --cache-from image-name exit status 1
BUILD State: FAILED
Pushing the Docker images..
An image does not exist locally with the tag

I am not sure about the error, what am i missing? EC2/ECS , memory and space seems good.

1回答
1

Try giving your CodeBuild instance a higher compute type since the error mentions that it's run out of memory. Also check and rule out if you are exceeding the default timeout values for the build job (1 hour). Both these options are available as Additional Configuration in Environment section.

profile picture
Syd
回答済み 2年前
  • I was able to resolve this issue by increasing the default configuration in codebuild from smaller cpu to larger one. it was indeed a memory issue.

    Another question, what triggers this memory issue, how to ensure that this memory issue doesn't occur frequently and I don't need to increase the memory frequently.

  • I'm no expert with npm run build. But unless the originally reported issue was intermittent, I would assume that the codebuild instance was undersized. Now that you changed the instance, the issue should not recur soon. The only time you might need more memory / cpu is when whatever npm build does in the background needs more processing capacity due to increased dependencies or more things to build... something of that sort...

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ