Files
TravelMate/backend/deploy.sh
2025-12-30 15:37:10 +01:00

44 lines
1.3 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Configuration
PROJECT_ID="travelmate-a47f5"
SERVICE_NAME="travelmate-backend"
REGION="europe-west1" # Vous pourrez changer ceci si besoin
echo "🚀 Déploiement de $SERVICE_NAME sur $PROJECT_ID..."
# Vérification de gcloud
if ! command -v gcloud &> /dev/null
then
echo "❌ gcloud n'est pas installé."
echo "👉 Installez le Google Cloud SDK : https://cloud.google.com/sdk/docs/install"
echo "Puis lancez 'gcloud auth login' et 'gcloud auth application-default login'"
exit 1
fi
# Build sur Cloud Build (plus simple que Docker local et push)
echo "📦 Construction de l'image sur Google Cloud Build..."
gcloud builds submit --tag gcr.io/$PROJECT_ID/$SERVICE_NAME --project $PROJECT_ID .
if [ $? -ne 0 ]; then
echo "❌ Échec du build."
exit 1
fi
# Déploiement sur Cloud Run
echo "🚀 Déploiement sur Cloud Run..."
gcloud run deploy $SERVICE_NAME \
--image gcr.io/$PROJECT_ID/$SERVICE_NAME \
--platform managed \
--region $REGION \
--project $PROJECT_ID \
--allow-unauthenticated \
--set-env-vars GA4_PROPERTY_ID=507003174
if [ $? -eq 0 ]; then
echo "✅ Déploiement terminé avec succès !"
echo " Récupérez l'URL ci-dessus pour votre MauiProgram.cs"
else
echo "❌ Échec du déploiement."
fi