1
- name : Deploy to AWS ECR
1
+ # name: Deploy to AWS ECR
2
+
3
+ # on:
4
+ # push:
5
+ # branches:
6
+ # - main
7
+
8
+ # env:
9
+ # AWS_REGION: "eu-central-1" # set this to your preferred AWS region, e.g. us-west-1
10
+
11
+ # jobs:
12
+ # deploy:
13
+ # runs-on: ubuntu-latest
14
+
15
+ # permissions:
16
+ # contents: read
17
+ # id-token: write
18
+
19
+ # steps:
20
+ # # Checkout the code
21
+ # - name: Checkout Code
22
+ # uses: actions/checkout@v3
23
+
24
+ # # Set up AWS credentials
25
+ # - name: Configure AWS credentials
26
+ # uses: aws-actions/configure-aws-credentials@v4
27
+ # with:
28
+ # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
29
+ # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
30
+ # aws-region: ${{ env.AWS_REGION }}
31
+
32
+ # # Login to Amazon ECR
33
+ # - name: Login to Amazon ECR
34
+ # id: login-ecr
35
+ # uses: aws-actions/amazon-ecr-login@v2
36
+
37
+ # # Build and tag the Docker image
38
+ # - name: Build and Tag Docker Image
39
+ # run: |
40
+ # docker build -t kotlin-spring-postgres-demo-app .
41
+ # docker tag kotlin-spring-postgres-demo-app:latest ${{ steps.login-ecr.outputs.registry }}/kotlin-spring-postgres-demo-app:latest
42
+
43
+ # # Push the Docker image to Amazon ECR
44
+ # - name: Push Docker Image to Amazon ECR
45
+ # run: |
46
+ # docker push ${{ steps.login-ecr.outputs.registry }}/kotlin-spring-postgres-demo-app:latest
47
+ name : Deploy to Public AWS ECR
2
48
3
49
on :
4
50
push :
5
51
branches :
6
52
- main
7
53
8
54
env :
9
- AWS_REGION : " eu-central-1" # set this to your preferred AWS region, e.g. us-west-1
55
+ AWS_REGION : " eu-central-1" # Your preferred AWS region
10
56
11
57
jobs :
12
58
deploy :
@@ -28,19 +74,19 @@ jobs:
28
74
aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
29
75
aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
30
76
aws-region : ${{ env.AWS_REGION }}
31
-
32
- # Login to Amazon ECR
33
- - name : Login to Amazon ECR
34
- id : login-ecr
35
- uses : aws-actions/amazon-ecr- login@v2
77
+
78
+ # Authenticate to Amazon Public ECR
79
+ - name : Login to Public ECR
80
+ run : |
81
+ aws ecr-public get-login-password --region ${{ env.AWS_REGION }} | docker login --username AWS --password-stdin public.ecr.aws
36
82
37
83
# Build and tag the Docker image
38
84
- name : Build and Tag Docker Image
39
85
run : |
40
86
docker build -t kotlin-spring-postgres-demo-app .
41
- docker tag kotlin-spring-postgres-demo-app:latest ${{ steps.login- ecr.outputs.registry }} /kotlin-spring-postgres-demo-app:latest
87
+ docker tag kotlin-spring-postgres-demo-app:latest public. ecr.aws/b1y7k5v4 /kotlin-spring-postgres-demo-app:latest
42
88
43
- # Push the Docker image to Amazon ECR
44
- - name : Push Docker Image to Amazon ECR
89
+ # Push the Docker image to Amazon Public ECR
90
+ - name : Push Docker Image to Public ECR
45
91
run : |
46
- docker push ${{ steps.login- ecr.outputs.registry }} /kotlin-spring-postgres-demo-app:latest
92
+ docker push public. ecr.aws/b1y7k5v4 /kotlin-spring-postgres-demo-app:latest
0 commit comments