feat: Déploiement via SSH dans .gitlab-ci.yml

This commit is contained in:
Serreau Jovann
2025-07-16 13:52:25 +02:00
parent ef72a93c23
commit 8ef9358599

View File

@@ -89,8 +89,18 @@ analyse_code:
deploy_application:
stage: deploy
before_script:
- apt-get update --fix-missing
- apt-get install -qq git
# Setup SSH deploy keys
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- echo "Starting deployment stage..."
- ssh bot@35.204.191.160 "cd /var/www/mainframe/app && nohup sh ./update.sh"
- echo "Application deployed successfully."
needs:
- analyse_code # Ce job dépend maintenant du job 'analyse_code'