version: 0.2 phases: install: commands: - sudo yum install docker -y pre_build: commands: - aws --version - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin ECR_REPO_URL - IMAGE_TAG=latest - REPOSITORY_URI=ECR_REPO_URL build: commands: - echo Build started on `date` - echo Building the Docker image... - docker build -t $REPOSITORY_URI:$IMAGE_TAG . post_build: commands: - echo Build completed on `date` - docker push $REPOSITORY_URI:$IMAGE_TAG - printf '[{"name":"tfmodernize-container","imageUri":"IMAGE_URI"}]' > imagedefinitions.json - REPO_URI="$REPOSITORY_URI":"$IMAGE_TAG" - sed -i -e "s|IMAGE_URI|$REPO_URI|g" imagedefinitions.json artifacts: files: - '**/*'