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...

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠