Skip to content

Commit 03d3e12

Browse files
update the github actions flow
1 parent a7643c7 commit 03d3e12

1 file changed

Lines changed: 14 additions & 17 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,32 @@ jobs:
1414
- name: Checkout code
1515
uses: actions/checkout@v3
1616

17-
- name: Log in to Docker Hub
18-
uses: docker/login-action@v2
19-
with:
20-
username: ${{ secrets.DOCKERHUB_USERNAME }}
21-
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
22-
23-
- name: Build and push Docker image
24-
run: |
25-
docker build -t your-dockerhub-username/blissme-frontend:latest .
26-
docker push your-dockerhub-username/blissme-frontend:latest
27-
2817
- name: Set up SSH key
2918
run: |
3019
mkdir -p ~/.ssh
3120
echo "${{ secrets.EC2_SSH_KEY }}" > ~/.ssh/id_rsa
3221
chmod 600 ~/.ssh/id_rsa
3322
34-
- name: Connect to EC2 and deploy container
23+
- name: Connect to EC2 and deploy
3524
uses: appleboy/ssh-action@master
3625
with:
3726
host: ${{ secrets.EC2_HOST }}
3827
username: ubuntu
3928
key: ${{ secrets.EC2_SSH_KEY }}
4029
script: |
41-
docker pull your-dockerhub-username/blissme-frontend:latest
30+
cd blissme-app
31+
32+
echo "🟢 Pulling latest code from GitHub..."
33+
git pull origin main
34+
35+
echo "🟢 Building Docker image..."
36+
docker build -t frontend-app .
4237
43-
docker stop blissme-frontend || true
44-
docker rm blissme-frontend || true
38+
echo "🟢 Stopping old container (if exists)..."
39+
docker stop frontend-app || true
40+
docker rm frontend-app || true
4541
46-
docker run -d -p 80:80 --name blissme-frontend your-dockerhub-username/blissme-frontend:latest
42+
echo "🟢 Running new container..."
43+
docker run -d -p 80:80 --name frontend-app frontend-app
4744
48-
echo "✅ Frontend deployed successfully!"
45+
echo "✅ Frontend deployed successfully!"

0 commit comments

Comments
 (0)