-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcloudbuild-app-old.yml
53 lines (53 loc) · 2.06 KB
/
cloudbuild-app-old.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
steps:
# Build the container image
- name: 'buildpacksio/pack'
entrypoint: 'pack'
args:
- build
- gcr.io/$PROJECT_ID/oos-api:$SHORT_SHA
- --cache-image=gcr.io/$PROJECT_ID/oos-cache:api
- --builder=paketobuildpacks/builder-jammy-base:latest
- --buildpack=gcr.io/paketo-buildpacks/dotnet-core
- --buildpack=gcr.io/paketo-buildpacks/environment-variables
- --env=BP_DOTNET_PROJECT_PATH=./OutOfSchool/OutOfSchool.WebApi/
- --env=BPE_AppDefaults__Version=$SHORT_SHA
- --publish
# Deploy container image to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
args:
- beta
- run
- deploy
- apiservice
- --image
- gcr.io/$PROJECT_ID/oos-api:$SHORT_SHA
- --region
- $_REGION
- --platform
- managed
- --ingress
- internal-and-cloud-load-balancing
- --allow-unauthenticated
- --service-account
- $_SERVICE_ACCOUNT
- --cpu=2
- --memory=1Gi
- --max-instances=5
- --concurrency=200
- --timeout=120
- --set-env-vars=ASPNETCORE_ENVIRONMENT=$_ASPNETCORE_ENVIRONMENT
- --set-env-vars=Elasticsearch__User=webapi
- --set-env-vars=ConnectionStringsOverride__DefaultConnection__UserId=api
- --set-env-vars=ConnectionStringsOverride__DefaultConnection__Port=$_SQL_PORT
- --set-env-vars=GoogleCloudPlatform__Storage__OosImages__BucketName=$_BUCKET
- --set-env-vars=Redis__Server=$_REDIS_HOST
- --set-env-vars=Redis__Port=$_REDIS_PORT
- --set-env-vars=AppDefaults__Version=$SHORT_SHA
- --set-secrets=ConnectionStringsOverride__DefaultConnection__Password=$_DB_PASS,Elasticsearch__Password=$_ES_PASSWORD,Redis__Password=$_REDIS_PASS,GeoCoding__ApiKey=$_GEO_KEY
- --no-use-http2
# Clean old versions except previous Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: bash
args:
- -c
- for revision in `gcloud run revisions list --service apiservice --platform managed --region $_REGION --format 'value(name)' | sort -r | tail -n +3 | paste -sd " " -`; do $(yes | gcloud run revisions delete --platform managed --region $_REGION $revision) || exit 0; done;