| version: 0.2 | |
| env: | |
| variables: | |
| IMAGE_REPO_NAME: vscodebuild | |
| phases: | |
| pre_build: | |
| commands: | |
| - export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query 'Account' --output=text) | |
| - $(aws ecr get-login --region $AWS_REGION --no-include-email) | |
| build: | |
| commands: | |
| - docker build -t $IMAGE_REPO_NAME . | |
| - docker tag $IMAGE_REPO_NAME:latest $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$IMAGE_REPO_NAME:latest | |
| post_build: | |
| commands: | |
| - docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$IMAGE_REPO_NAME:latest | |