-
Notifications
You must be signed in to change notification settings - Fork 5
/
cloudbuild-old.yaml
59 lines (59 loc) · 1.96 KB
/
cloudbuild-old.yaml
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
54
55
56
57
58
59
steps:
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'sh'
args:
- '-c'
- |
cat <<EOF > src/environments/environment.qa.ts
export const environment = {
production: true,
stsServer: '$_STS_SERVER',
serverUrl: '$_API_SERVER',
storageUrl: 'https://storage.googleapis.com/oos-images-63325/'
};
EOF
# Build the container image
- name: 'buildpacksio/pack'
entrypoint: 'pack'
args:
- build
- gcr.io/$PROJECT_ID/oos-frontend:$SHORT_SHA
- --cache-image=gcr.io/$PROJECT_ID/oos-frontend:cache
- --builder=paketobuildpacks/builder:base
- --buildpack=paketo-buildpacks/web-servers
- --buildpack=gcr.io/paketo-buildpacks/environment-variables
- --env=BP_NODE_RUN_SCRIPTS=build:qa
- --env=BPE_APP_ROOT=/workspace
- --env=BP_INCLUDE_FILES=dist/out-of-school/*:nginx.conf:includes/*
- --publish
# Deploy container image to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
args:
- beta
- run
- deploy
- $_SERVICE_NAME
- --image
- gcr.io/$PROJECT_ID/oos-frontend:$SHORT_SHA
- --region
- $_REGION
- --platform
- managed
- --ingress
- internal-and-cloud-load-balancing
- --allow-unauthenticated
- --service-account
- $_SERVICE_ACCOUNT
- --cpu=1
- --memory=128Mi
- --max-instances=4
- --concurrency=40
- --set-env-vars=APP_ROOT=/workspace
# Disable http2 because prod will be http1.1 for now
- --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 $_SERVICE_NAME --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;