forked from buerokratt/Classifier
-
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.
This is the workflow to deploy frontend in EC2
- Loading branch information
1 parent
e19081a
commit 158bf34
Showing
1 changed file
with
41 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Deploy Frontend | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
deploy: | ||
runs-on: [self-hosted, est-cls-dev] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Remove all running containers, images, and prune Docker system | ||
run: | | ||
docker stop $(docker ps -a -q) || true | ||
docker rm $(docker ps -a -q) || true | ||
docker rmi $(docker images -q) || true | ||
docker system prune -af | ||
- name: Build and run Docker Compose | ||
run: | | ||
cd GUI | ||
docker-compose up --build -d | ||
- name: Get public IP address | ||
id: get_ip | ||
run: | | ||
PUBLIC_IP=$(curl -s http://checkip.amazonaws.com) | ||
echo "PUBLIC_IP=$PUBLIC_IP" >> $GITHUB_ENV | ||
- name: Send Slack notification | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
PUBLIC_IP: ${{ env.PUBLIC_IP }} | ||
run: | | ||
curl -X POST -H 'Content-type: application/json' --data "{ | ||
\"text\": \"Build is complete. Public IP: $PUBLIC_IP\" | ||
}" $SLACK_WEBHOOK_URL |