pack code build fail

0

Hi team,

i'm trying to create AWS code build using this example :

https://aws.amazon.com/blogs/containers/creating-container-images-with-cloud-native-buildpacks-using-aws-codebuild-and-aws-codepipeline/

it finish always with error on this command at the end of the buildspec file:

./pack build --no-color --builder $builder \
      --tag $IMAGE_TAG $ECR_REPOSITORY:latest \
      --cache-image $ECR_REPOSITORY:cache \
      --publish

I have this error :

ERROR: failed to : ensure registry read access to 111111111.dkr.ecr.region.amazonaws.com/myrepo:latest

ERROR: failed to build: executing lifecycle: failed with status code: 1

not sure what I did wrong? I tried to follow the blog's buildspec as is

I already added the required ECR permissions to the code build service role

update:

I added the adminAccess to the code build service role to see if it's a permissions issue

now I have this error :

===> ANALYZING
Restoring data for SBOM from previous image
===> DETECTING
ERROR: No buildpack groups passed detection.
ERROR: Please check that you are running against the correct path.
ERROR: failed to detect: no buildpacks participating
ERROR: failed to build: executing lifecycle: failed with status code: 20

[Container]  Command did not exit successfully ./pack build --no-color --builder $builder \
--tag $IMAGE_TAG $REPOSITORY_URI:latest \
--cache-image $REPOSITORY_URI:cache \
--publish
 exit status 1

basically I just want to generate the docker image of my spring boot appli in buildspec.yml without using a docker file,

if there is any other method then using packbuikders?

I appreciate your help on this

Cheers,

1 Answer
0

It seems you are having the issue with ECR login.

Please double-check that you are logging in correctly. Check your buildspec

# Log in to ECR
    - ECR_DOMAIN="$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com"
    - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $ECR_DOMAIN

Ref: https://docs.aws.amazon.com/AmazonECR/latest/userguide/registry_auth.html

profile picture
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions