-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.yaml
76 lines (71 loc) · 2.54 KB
/
build.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
steps:
#################################################################
# Build
#################################################################
- id: "build"
name: "docker/compose:1.29.2"
args: [
"build",
"server"
]
env:
- "COMPOSE_FILE=docker/docker-compose.production.yml"
- "COMPOSE_PROJECT_NAME=backend-booster-graphql-postgresql"
#################################################################
# Tag
#################################################################
- name: "gcr.io/cloud-builders/docker"
args: [
"tag",
"backend-booster-graphql-postgresql_server:production",
"gcr.io/$PROJECT_ID/server:$SHORT_SHA"
]
- name: "gcr.io/cloud-builders/docker"
args: [
"tag",
"backend-booster-graphql-postgresql_server:production",
"gcr.io/$PROJECT_ID/server:development"
]
#################################################################
# Push
#################################################################
- id: "push"
name: "gcr.io/cloud-builders/docker"
args: [
"push",
"gcr.io/$PROJECT_ID/server"
]
#################################################################
# Migrate
#################################################################
- id: "migrate"
name: "gcr.io/google-appengine/exec-wrapper"
args: [
"-i", "gcr.io/$PROJECT_ID/server:development",
"-s", "$PROJECT_ID:us-central1:development",
"-e", "DATABASE_HOST=${_DATABASE_HOST}",
"-e", "DATABASE_USERNAME=${_DATABASE_USERNAME}",
"-e", "DATABASE_PASSWORD=${_DATABASE_PASSWORD}",
"-e", "DATABASE_NAME=${_DATABASE_NAME}",
"--", "npm", "run", "db:migrate:up"
]
#################################################################
# Deploy
#################################################################
- id: "deploy"
name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
entrypoint: gcloud
args: [
"run", "deploy", "server-development",
"--allow-unauthenticated",
"--platform", "managed",
"--region", "us-central1",
"--add-cloudsql-instances", "development",
"--image", "gcr.io/$PROJECT_ID/server:development",
"--set-env-vars", "APP_ENV=${_APP_ENV}",
"--set-env-vars", "JWT_SECRET=${_JWT_SECRET}",
"--set-env-vars", "DATABASE_HOST=${_DATABASE_HOST}",
"--set-env-vars", "DATABASE_USERNAME=${_DATABASE_USERNAME}",
"--set-env-vars", "DATABASE_PASSWORD=${_DATABASE_PASSWORD}",
"--set-env-vars", "DATABASE_NAME=${_DATABASE_NAME}"
]