cohorta/.gitea/workflows/deploy.yml
Vadym Samoilenko ea3afc526a
All checks were successful
Deploy to Production / deploy (push) Successful in 59s
fix: use python health check inside container (no curl/wget in image)
2026-05-23 19:07:53 +01:00

41 lines
1.3 KiB
YAML

name: Deploy to Production
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Pull latest code
run: |
set -euo pipefail
echo "=== Pulling latest code ==="
git -C /opt/03-business/cohorta pull origin main --ff-only
git -C /opt/03-business/cohorta log --oneline -3
- name: Ensure traefik-public network
run: |
docker network ls --format '{{.Name}}' | grep -q '^traefik-public$' \
|| docker network create traefik-public
- name: Build and restart containers
run: |
set -euo pipefail
cd /opt/03-business/cohorta
docker compose build --no-cache frontend backend
docker compose up -d --remove-orphans
- name: Health check
run: |
echo "Waiting for backend..."
for i in $(seq 1 30); do
docker exec cohorta-backend-1 python3 -c "import urllib.request; urllib.request.urlopen('http://localhost:5137/api/health')" 2>/dev/null && echo "✓ Backend healthy" && break
sleep 3
done
docker compose -f /opt/03-business/cohorta/docker-compose.yml ps
- name: Done
run: echo "=== Deploy complete === https://cohorta.ai-impress.com"