forked from amplication/amplication
-
Notifications
You must be signed in to change notification settings - Fork 0
/
production.cloudbuild.yaml
42 lines (38 loc) · 1.35 KB
/
production.cloudbuild.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
steps:
- id: "docker-pull"
name: "gcr.io/cloud-builders/docker"
args: ["pull", "$_IMAGE:$SHORT_SHA"]
- id: "docker-inspect"
name: "gcr.io/cloud-builders/docker"
entrypoint: bash
args:
- -c
- |
set -o xtrace;
image_id=$(docker inspect --format='{{index .RepoDigests 0}}' $_IMAGE:$SHORT_SHA);
printf "\\nimage_id = \"$image_id\"" >> terraform/envs/production/terraform.tfvars;
- id: "terraform-init"
name: "hashicorp/terraform:0.13.3"
args: ["init"]
dir: terraform/envs/production
- id: "terraform-apply"
name: "hashicorp/terraform:0.13.3"
args:
- "apply"
- "-auto-approve"
# 20 minutes
- "-lock-timeout=1200s"
dir: terraform/envs/production
- name: "node:12-stretch"
entrypoint: bash
args:
- -c
- |
set -e;
wget -O /workspace/cloud_sql_proxy https://storage.googleapis.com/cloudsql-proxy/v1.16/cloud_sql_proxy.linux.386;
chmod +x /workspace/cloud_sql_proxy;
/workspace/cloud_sql_proxy -dir=/workspace -instances=$PROJECT_ID:$_REGION:$_DB_INSTANCE=tcp:5432 & sleep 2
cd packages/amplication-server/prisma/;
POSTGRESQL_URL="postgresql://$_POSTGRESQL_USER:$_POSTGRESQL_PASSWORD@localhost:5432/$_POSTGRESQL_DB" npx @prisma/cli migrate up --create-db --auto-approve --experimental;
# 1 hour
timeout: 3600s