-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,36 +51,39 @@ jobs: | |
DAGSHUB_PAT: ${{ secrets.DAGSHUB_PAT }} | ||
run: python -m unittest tests/test_flask_app.py | ||
|
||
- name: Login to Dcokerhub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME}} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN}} | ||
- name: Login to AWS ECR | ||
run: | | ||
aws configure set aws_access_key_id ${ {secrets.AWS_ACCESS_KEY_ID }} | ||
aws configure set aws_secret_access_key ${ {secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws ecr get-login-password --region eu-north-1 | docker login --username AWS --password-stdin 843369994444.dkr.ecr.eu-north-1.amazonaws.com | ||
- name: Build Docker Image | ||
if: success() | ||
run: | | ||
docker build -t ${{ secrets.DOCKER_HUB_USERNAME}}/text-classification-using-mlops:latest . | ||
docker build -t text-classification . | ||
- name: Push Dcoker image to Dockerhub | ||
if: success() | ||
- name: Tag Docker Image | ||
run: | | ||
docker tag text-classification:latest 843369994444.dkr.ecr.eu-north-1.amazonaws.com/text-classification:latest | ||
- name: Push Docker Image to AWS ECR | ||
run: | | ||
docker push ${{ secrets.DOCKER_HUB_USERNAME}}/text-classification-using-mlops:latest | ||
docker push 843369994444.dkr.ecr.eu-north-1.amazonaws.com/text-classification:latest | ||
Deploy-to-EC2: | ||
runs-on: ubuntu-latest | ||
needs: test-and-package | ||
steps: | ||
# Deploy-to-EC2: | ||
# runs-on: ubuntu-latest | ||
# needs: test-and-package | ||
|
||
- name: Deploy to EC2 | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USER }} | ||
key: ${{ secrets.EC2_SSH_KEY }} | ||
script: | | ||
docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/text-classification-using-mlops:latest | ||
docker stop my-app || true | ||
docker rm my-app || true | ||
docker run -d -p 80:5000 --name my-app -e DAGSHUB_PAT=${{ secrets.DAGSHUB_PAT }} ${{ secrets.DOCKER_HUB_USERNAME }}/text-classification-using-mlops:latest | ||
# steps: | ||
|
||
# - name: Deploy to EC2 | ||
# uses: appleboy/[email protected] | ||
# with: | ||
# host: ${{ secrets.EC2_HOST }} | ||
# username: ${{ secrets.EC2_USER }} | ||
# key: ${{ secrets.EC2_SSH_KEY }} | ||
# script: | | ||
# docker pull ${{ secrets.DOCKER_HUB_USERNAME }}/text-classification-using-mlops:latest | ||
# docker stop my-app || true | ||
# docker rm my-app || true | ||
# docker run -d -p 80:5000 --name my-app -e DAGSHUB_PAT=${{ secrets.DAGSHUB_PAT }} ${{ secrets.DOCKER_HUB_USERNAME }}/text-classification-using-mlops:latest |