ci: switch to self-hosted runner, run deploy directly on host
This commit is contained in:
@@ -7,16 +7,26 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: self-hosted
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Pull latest code
|
||||||
uses: actions/checkout@v4
|
run: |
|
||||||
|
cd /opt/hotelsync/app
|
||||||
|
git fetch http://golomazov:Jbs5%40TikW@localhost:3001/golomazov/hotelsync.git main
|
||||||
|
git reset --hard FETCH_HEAD
|
||||||
|
echo "✅ Code updated"
|
||||||
|
|
||||||
|
- name: Copy env
|
||||||
|
run: cp /opt/hotelsync/.env /opt/hotelsync/app/.env
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: |
|
run: |
|
||||||
|
cd /opt/hotelsync/app
|
||||||
docker build -t hotelsync-frontend:latest .
|
docker build -t hotelsync-frontend:latest .
|
||||||
|
echo "✅ Image built"
|
||||||
|
|
||||||
- name: Deploy frontend
|
- name: Restart frontend container
|
||||||
run: |
|
run: |
|
||||||
docker stop hotelsync-frontend 2>/dev/null || true
|
docker stop hotelsync-frontend 2>/dev/null || true
|
||||||
docker rm hotelsync-frontend 2>/dev/null || true
|
docker rm hotelsync-frontend 2>/dev/null || true
|
||||||
@@ -25,9 +35,9 @@ jobs:
|
|||||||
--network hotelsync_hotelsync-net \
|
--network hotelsync_hotelsync-net \
|
||||||
--restart unless-stopped \
|
--restart unless-stopped \
|
||||||
hotelsync-frontend:latest
|
hotelsync-frontend:latest
|
||||||
echo "✅ Deploy complete!"
|
echo "✅ Container started"
|
||||||
|
|
||||||
- name: Health check
|
- name: Health check
|
||||||
run: |
|
run: |
|
||||||
sleep 3
|
sleep 3
|
||||||
curl -sf http://hotelsync-frontend/ > /dev/null && echo "✅ App is up!" || echo "❌ Health check failed"
|
curl -sf http://localhost/ > /dev/null && echo "✅ App is alive!" || echo "⚠️ Check app manually"
|
||||||
|
|||||||
Reference in New Issue
Block a user