bakalarka_praca/website/prepare-app-cloud.sh

26 lines
693 B
Bash

#!/bin/bash
# Nastavenia
REGION="europe-central2"
PROJECT_ID="hatespeechsite"
REPO_NAME="hatespeech-registry"
IMAGE_NAME="hate-detektor"
IMAGE_URI="$REGION-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/$IMAGE_NAME"
INSTANCE_CONNECTION="hatespeechsite:europe-central2:hate-db"
DATABASE_URL="postgresql://user:password@/mydb?host=/cloudsql/$INSTANCE_CONNECTION"
echo "Build"
gcloud builds submit --tag $IMAGE_URI
echo "Deploy"
gcloud run deploy $IMAGE_NAME \
--image $IMAGE_URI \
--platform managed \
--region $REGION \
--allow-unauthenticated \
--port 8080 \
--memory=2Gi \
--timeout=600s \
--add-cloudsql-instances=$INSTANCE_CONNECTION \
--set-env-vars=DATABASE_URL=$DATABASE_URL