forked from REAN-Foundation/reancare-service
-
Notifications
You must be signed in to change notification settings - Fork 2
54 lines (45 loc) · 1.93 KB
/
ec2-deploy-ci-cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# name: Reancare Deployment
# on:
# push:
# branches:
# - []
# jobs:
# deploy:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Install AWS CLI
# run: |
# sudo apt-get update
# sudo apt-get install -y awscli
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v2
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# aws-region: ap-south-1
# - name: Login to Amazon ECR
# run: aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin 443751504066.dkr.ecr.ap-south-1.amazonaws.com
# - name: Build Docker image
# run: |
# docker build -t 443751504066.dkr.ecr.ap-south-1.amazonaws.com/reancare:${{ github.sha }} .
# docker push 443751504066.dkr.ecr.ap-south-1.amazonaws.com/reancare:${{ github.sha }}
# # - name: Download private key from S3
# # run: |
# # aws s3 cp s3://reancare-configs/reancare-service/rean-service-key.pem ./rean-service-key.pem
# # env:
# # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# - name: SSH into EC2 instance
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.EC2_HOST }}
# username: ${{ secrets.EC2_USERNAME }}
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# port: ${{ secrets.SSH_PORT }}
# script: |
# docker stop reancare-container || true
# docker rm reancare-container || true
# docker pull 443751504066.dkr.ecr.ap-south-1.amazonaws.com/reancare:${{ github.sha }}
# docker run -d -p 7272:7272 --network host --name reancare-container 443751504066.dkr.ecr.ap-south-1.amazonaws.com/reancare:${{ github.sha }}