From 2d7425bd070ec7d52dd49e9534f358c317cd82ea Mon Sep 17 00:00:00 2001 From: canguilieme julien Date: Sun, 6 Oct 2024 18:17:23 +0200 Subject: [PATCH] add docker files --- .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..3a621b6 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,34 @@ +stages: + - build + - test + - deploy + +build-job: + stage: build + script: + - echo "Compilation du code..." + # Ajoutez vos commandes de build ici + +test-job: + stage: test + script: + - echo "Exécution des tests..." + # Ajoutez vos commandes de test ici + +deploy-job: + stage: deploy + script: + - echo "Déploiement sur Portainer..." + - | + TOKEN=$(curl -s -X POST -d "{\"Username\":\"$PORTAINER_USERNAME\",\"Password\":\"$PORTAINER_PASSWORD\"}" \ + -H "Content-Type: application/json" http://$PORTAINER_URL/api/auth | jq -r .jwt) + - | + curl -s -X PUT \ + -H "Authorization: Bearer $TOKEN" \ + -H "Content-Type: application/json" \ + -d '{"Prune": true}' \ + http://$PORTAINER_URL/api/stacks/$STACK_ID/deploy + - echo "Déploiement terminé." + dependencies: + - build-job + - test-job