P5-7547 Fix ecr login and add tag (#42)

This commit is contained in:
Niklas Fondberg
2021-07-19 12:50:50 +02:00
committed by GitHub
parent 3969bc54df
commit 454d9b852f
2 changed files with 47 additions and 22 deletions
+5 -3
View File
@@ -239,10 +239,10 @@ Resources:
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
HealthCheckIntervalSeconds: 10
HealthCheckIntervalSeconds: 15
# will look for a 200 status code by default unless specified otherwise
HealthCheckPath: !Ref HealthCheckPath
HealthCheckTimeoutSeconds: 5
HealthCheckTimeoutSeconds: 10
UnhealthyThresholdCount: 2
HealthyThresholdCount: 2
Name: !Join ["", [!Ref "AWS::StackName", TargetGroup]]
@@ -433,7 +433,7 @@ Resources:
post_build:
commands:
- echo Logging in to ECR to push image
- $(aws ecr get-login --no-include-email --region eu-west-1)
- 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
- docker push "$IMAGE_URI"
- docker push "$IMAGE_LATEST_URI"
- printf '[{"name":"%s","imageUri":"%s"}]' "$IMAGE_NAME" "$IMAGE_LATEST_URI" > images.json
@@ -447,6 +447,8 @@ Resources:
EnvironmentVariables:
- Name: AWS_DEFAULT_REGION
Value: !Ref AWS::Region
- Name: AWS_ACCOUNT_ID
Value: !Ref AWS::AccountId
- Name: REPOSITORY_URI
Value: !Ref Image
- Name: IMAGE_NAME