@@ -70,20 +70,24 @@ jobs:
70
70
docker push 843369994444.dkr.ecr.eu-north-1.amazonaws.com/text-classification:latest
71
71
72
72
73
- # Deploy-to-EC2:
74
- # runs-on: ubuntu-latest
75
- # needs: test-and-package
73
+ Deploy-to-EC2 :
74
+ runs-on : ubuntu-latest
75
+ needs : test-and-package
76
76
77
- # steps:
77
+ steps :
78
78
79
- # - name: Deploy to EC2
80
- # uses: appleboy/ssh-action@v0.1.5
81
- # with:
82
- # host: ${{ secrets.EC2_HOST }}
83
- # username: ${{ secrets.EC2_USER }}
84
- # key: ${{ secrets.EC2_SSH_KEY }}
85
- # script: |
86
- # docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/text-classification-using-mlops:latest
87
- # docker stop my-app || true
88
- # docker rm my-app || true
89
- # docker run -d -p 80:5000 --name my-app -e DAGSHUB_PAT=${{ secrets.DAGSHUB_PAT }} ${{ secrets.DOCKER_HUB_USERNAME }}/text-classification-using-mlops:latest
79
+ - name : Deploy to EC2
80
+ uses : appleboy/ssh-action@v0.1.5
81
+ with :
82
+ host : ${{ secrets.EC2_HOST }}
83
+ username : ${{ secrets.EC2_USER }}
84
+ key : ${{ secrets.EC2_SSH_KEY }}
85
+ script : |
86
+ aws configure set aws_access_key_id ${{secrets.AWS_ACCESS_KEY_ID }}
87
+ aws configure set aws_secret_access_key ${{secrets.AWS_SECRET_ACCESS_KEY }}
88
+ aws set default.region eu-north-1
89
+ aws ecr get-login-password --region eu-north-1 | docker login --username AWS --password-stdin 843369994444.dkr.ecr.eu-north-1.amazonaws.com
90
+ docker pull 843369994444.dkr.ecr.eu-north-1.amazonaws.com/text-classification:latest
91
+ docker stop text-classification || true
92
+ docker rm text-classification || true
93
+ docker run -d -p 80:5000 -e DAGSHUB_PAT= ${{ secrets.DAGSHUB_PAT }} --name text-classification 843369994444.dkr.ecr.eu-north-1.amazonaws.com/text-classification:v1
0 commit comments