--- version: 0.2 env: variables: ImageRepoName: "security-orchestrator" phases: install: commands: - AwsAccountId=$(aws sts get-caller-identity --query 'Account' --output text) - AwsAccountId=$(echo $AwsAccountId | tr -d '\n' | tr -d '\r') - SHA=$(git rev-parse --short HEAD) - DockerRepo=$AwsAccountId.dkr.ecr.$AWS_REGION.amazonaws.com - DockerImageName=$DockerRepo/${CODEBUILD_BUILD_ID%:*}:$VERSION-$SHA - aws ecr get-login-password | docker login --username AWS --password-stdin $DockerRepo pre_build: commands: - echo Restore started on `date` build: commands: - echo Build started on `date` - echo "$AwsAccountId.dkr.ecr.$AWS_REGION.amazonaws.com/$ImageRepoName:$SHA" - echo Creating the docker images for the service # Creating and tagging the image for the service - docker build . -t $AwsAccountId.dkr.ecr.$AWS_REGION.amazonaws.com/$ImageRepoName:$SHA - echo Build completed on `date` post_build: commands: - echo Build completed on `date`