File tree Expand file tree Collapse file tree 2 files changed +37
-3
lines changed Expand file tree Collapse file tree 2 files changed +37
-3
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Deploy to DigitalOcean
2+
3+ on :
4+ push :
5+ branches : [main]
6+
7+ jobs :
8+ build-and-deploy :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Checkout code
13+ uses : actions/checkout@v3
14+
15+ - name : Log in to Docker Hub
16+ uses : docker/login-action@v2
17+ with :
18+ username : ${{ secrets.DOCKERHUB_USERNAME }}
19+ password : ${{ secrets.DOCKERHUB_TOKEN }}
20+
21+ - name : Build and push Docker image
22+ run : |
23+ docker build -t yourusername/yourapp:latest .
24+ docker push yourusername/yourapp:latest
25+
26+ - name : SSH and update on droplet
27+ 28+ with :
29+ host : ${{ secrets.DO_SSH_HOST }}
30+ username : ${{ secrets.DO_SSH_USER }}
31+ key : ${{ secrets.DO_SSH_KEY }}
32+ script : |
33+ docker pull yourusername/yourapp:latest
34+ cd /root/yourapp
35+ docker compose down
36+ docker compose up -d
Original file line number Diff line number Diff line change @@ -13,9 +13,7 @@ services:
1313
1414 # 2) Your PHP app service must build from your custom Dockerfile
1515 app :
16- build :
17- context : .
18- dockerfile : Dockerfile
16+ image : utkarshs7/ourawork:latest
1917 restart : unless-stopped
2018 working_dir : /var/www/html
2119 volumes :
You can’t perform that action at this time.
0 commit comments