This repository has been archived by the owner on Dec 10, 2024. It is now read-only.
generated from IgrowkerTraining/template-express-ts
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from igrowker/devops
Devops
- Loading branch information
Showing
2 changed files
with
21 additions
and
13 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 |
---|---|---|
|
@@ -54,7 +54,7 @@ jobs: | |
- name: Build and Push Docker Images | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ../../Dockerfile | ||
context: ./ | ||
push: true | ||
tags: | | ||
${{ secrets.DOCKERHUB_USERNAME }}/pawsome-node:backend | ||
|
@@ -83,15 +83,23 @@ jobs: | |
- name: Set up SSH key | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "${{ secrets.AWS_SSH_KEY }}" > ~/.ssh/aws-key.pem | ||
chmod 400 ~/.ssh/aws-key.pem | ||
echo "${{ secrets.AWS_SSH_KEY }}" > ~/.ssh/backend_key.pem | ||
chmod 400 ~/.ssh/backend_key.pem | ||
- name: Deploy Backend to AWS EC2 | ||
run: | | ||
ssh -o StrictHostKeyChecking=no -i ~/.ssh/aws-key.pem ec2-user@your-ec2-public-ip " | ||
cd ../../i004-pawsome-back || git clone https://github.com/igrowker/i004-pawsome-back ../.. && cd /i004-pawsome-back; | ||
git pull; | ||
npm install; | ||
npm run build; | ||
pm2 reload ecosystem.config.js || pm2 start ecosystem.config.js --env production | ||
ssh -o StrictHostKeyChecking=no -i ~/.ssh/backend_key.pem [email protected] " | ||
cd /home/ec2-user || mkdir /home/ec2-user; | ||
if [ ! -d /home/ec2-user/i004-pawsome-back ]; then | ||
git clone https://github.com/igrowker/i004-pawsome-back /home/ec2-user/i004-pawsome-back; | ||
fi; | ||
cd /home/ec2-user/i004-pawsome-back; | ||
git pull; | ||
npm install; | ||
npm run build; | ||
pm2 reload ecosystem.config.js || pm2 start ecosystem.config.js --env production; | ||
" |
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