23
23
run : |
24
24
docker build -t temp:latest -f Dockerfile .
25
25
26
- - name : Configure AWS credentials
26
+ - name : Configure AWS credentials Prod
27
27
uses : aws-actions/configure-aws-credentials@v1.7.0
28
28
29
29
with :
@@ -32,13 +32,36 @@ jobs:
32
32
role-session-name : GitHub_to_AWS_via_FederatedOIDC
33
33
aws-region : us-east-1
34
34
35
- - name : Login to Amazon ECR
36
- id : login-ecr-management
35
+ - name : Login to Amazon ECR Prod
36
+ id : login-ecr-management-prod
37
37
uses : aws-actions/amazon-ecr-login@v2
38
38
39
- - name : Tag and Push Image to Amazon ECR
39
+ - name : Tag and Push Image to Amazon ECR Prod
40
40
env :
41
- ECR_REGISTRY : ${{ steps.login-ecr-management.outputs.registry }}
41
+ ECR_REGISTRY : ${{ steps.login-ecr-management-prod.outputs.registry }}
42
+ ECR_REPOSITORY : ml-repository
43
+ IMAGE_TAG : scholarag-${{ github.ref_name }}
44
+ run : |
45
+ docker tag temp:latest $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
46
+ docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
47
+ docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG temp:latest
48
+
49
+ - name : Configure AWS credentials Staging
50
+ uses : aws-actions/configure-aws-credentials@v1.7.0
51
+
52
+ with :
53
+ role-to-assume : arn:aws:iam::992382665735:role/GitHub2ECR # check terraform output
54
+
55
+ role-session-name : GitHub_to_AWS_via_FederatedOIDC
56
+ aws-region : us-east-1
57
+
58
+ - name : Login to Amazon ECR Staging
59
+ id : login-ecr-management-staging
60
+ uses : aws-actions/amazon-ecr-login@v2
61
+
62
+ - name : Tag and Push Image to Amazon ECR Staging
63
+ env :
64
+ ECR_REGISTRY : ${{ steps.login-ecr-management-staging.outputs.registry }}
42
65
ECR_REPOSITORY : ml-repository
43
66
IMAGE_TAG : scholarag-${{ github.ref_name }}
44
67
run : |
0 commit comments