Skip to content

Commit

Permalink
fix: abort on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Atkinson committed Aug 16, 2021
1 parent ba7f058 commit 8c366f1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions buildspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@ version: 0.2

phases:
pre_build:
on-failure: ABORT
commands:
- echo Logging in to Amazon ECR...
# output version
- echo source version $CODEBUILD_SOURCE_VERSION
- echo build number $CODEBUILD_BUILD_NUMBER
# Logging in to Amazon ECR...
- 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
build:
on-failure: ABORT
commands:
- echo Build started on `date`
- echo Building the Docker image...
# Building the "production" Docker image
- docker build --target production -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:
on-failure: ABORT
commands:
- echo Build completed on `date`
- echo Pushing the Docker image...
# Pushing the Docker image to your ECR
- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG

0 comments on commit 8c366f1

Please sign in to comment.