fix: Dockerfile build + Gitea auto-deploy hooks
Deploy con Docker Compose / deploy (push) Has been cancelled

This commit is contained in:
2026-05-31 13:01:07 -05:00
parent 617c4dedb6
commit 0f29f8ef61
3 changed files with 185 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
# ─── Gitea Post-Receive Hook ────────────────────────────────────────────────
# Location: /home/ubuntu/gitea/gitea/git/repositories/silvioalzate/cirux.git/hooks/post-receive
# Owner: ubuntu (run as gitea service user)
# Make executable: chmod +x post-receive
set -e
APP_DIR="/opt/cirux"
LOG_FILE="/var/log/cirux-deploy.log"
BRANCH="main"
DEPLOY_SCRIPT="/opt/cirux/deploy-auto.sh"
echo "$(date '+%Y-%m-%d %H:%M:%S') - Push received, starting deploy..." >> "$LOG_FILE"
# Read refs from stdin (standard git hook input)
while read oldrev newrev refname; do
# Only deploy on main branch pushes
if [ "$refname" = "refs/heads/$BRANCH" ]; then
echo "$(date '+%Y-%m-%d %H:%M:%S') - Deploying branch: $BRANCH" >> "$LOG_FILE"
cd "$APP_DIR"
# Run deploy script
/opt/cirux/deploy-auto.sh >> "$LOG_FILE" 2>&1
# Verify health
sleep 5
if curl -sf http://localhost:3000/api/health > /dev/null 2>&1; then
echo "$(date '+%Y-%m-%d %H:%M:%S') - Deploy successful ✅" >> "$LOG_FILE"
else
echo "$(date '+%Y-%m-%d %H:%M:%S') - Health check failed ⚠️" >> "$LOG_FILE"
fi
fi
done
echo "$(date '+%Y-%m-%d %H:%M:%S') - Hook finished" >> "$LOG_FILE"