Codebuild caching not making differences in build times

0

The codebuild cache on both local and s3 buckets is not working. I have specified all the steps in the build_spec.yml file along with all the dependencies. The cache file is stored in an s3 bucket but does not work when a new build happens after that.

Hema
질문됨 8달 전316회 조회
1개 답변
0

Hi. Can you share a buildspec with us?

profile picture
답변함 8달 전
  • Hi, this is my build_spec file. version: 0.2 phases: install: commands: - echo Build and Deployment for $env environment - curl -sS -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/linux/amd64/aws-iam-authenticator - export PATH=$PWD/:$PATH - yum -y update --skip-broke && yum -y install jq python3-pip python3-dev && pip3 install --upgrade awscli

    pre_build: commands: - echo Logging in to Amazon ECR... - echo bn-api_$env_$CODEBUILD_BUILD_NUMBER - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com - IMAGE_TAG=bn_api_v$CODEBUILD_BUILD_NUMBER-$env build: commands: - echo Build started on date - echo Building the Docker image...
    - docker build --build-arg API_ENV=$env --build-arg AWS_ACCOUNT_ID=$AWS_ACCOUNT_ID --build-arg IMAGE_REPO_NAME=$BASE_IMAGE_REPO_NAME -t $IMAGE_REPO_NAME:$IMAGE_TAG . - docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG post_build: commands: - echo Build completed on date - echo Pushing the Docker image... - docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG artifacts: files: build.json cache: paths: - /root/.cache/pip - /usr/bin/share

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

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

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

관련 콘텐츠