2020-05-18 01:16:40 +02:00
|
|
|
steps:
|
|
|
|
# Build image with tag 'latest'
|
|
|
|
- name: "gcr.io/cloud-builders/docker"
|
|
|
|
args:
|
|
|
|
[
|
|
|
|
"build",
|
|
|
|
"--tag",
|
2020-05-27 01:41:28 +02:00
|
|
|
"gcr.io/$PROJECT_ID/{{- .AppNameSlug -}}:latest",
|
2020-05-18 01:16:40 +02:00
|
|
|
"--build-arg",
|
|
|
|
"GO_ENV=production",
|
|
|
|
".",
|
|
|
|
]
|
|
|
|
|
|
|
|
# Push new image to Google Container Registry
|
|
|
|
- name: "gcr.io/cloud-builders/docker"
|
2020-05-27 01:41:28 +02:00
|
|
|
args: ["push", "gcr.io/$PROJECT_ID/{{- .AppNameSlug -}}:latest"]
|
2020-05-18 01:16:40 +02:00
|
|
|
|
|
|
|
# Deploy image to Cloud Run
|
|
|
|
- name: "gcr.io/cloud-builders/gcloud"
|
|
|
|
args:
|
|
|
|
[
|
|
|
|
"run",
|
|
|
|
"deploy",
|
|
|
|
"data",
|
|
|
|
"--image",
|
2020-05-27 01:41:28 +02:00
|
|
|
"gcr.io/$PROJECT_ID/{{- .AppNameSlug -}}:latest",
|
2020-05-18 01:16:40 +02:00
|
|
|
"--add-cloudsql-instances",
|
2020-05-27 01:41:28 +02:00
|
|
|
"$PROJECT_ID:$REGION:{{- .AppNameSlug -}}_production",
|
2020-05-18 01:16:40 +02:00
|
|
|
"--region",
|
|
|
|
"$REGION",
|
|
|
|
"--platform",
|
|
|
|
"managed",
|
|
|
|
"--update-env-vars",
|
2020-05-27 01:41:28 +02:00
|
|
|
"GO_ENV=production,SG_DATABASE_HOST=/cloudsql/$PROJECT_ID:$REGION:{{- .AppNameSlug -}}_production,SECRETS_FILE=prod.secrets.yml",
|
2020-05-18 01:16:40 +02:00
|
|
|
"--port",
|
|
|
|
"8080",
|
|
|
|
"--service-account",
|
|
|
|
"$SERVICE_ACCOUNT",
|
|
|
|
"--allow-unauthenticated",
|
|
|
|
"--verbosity",
|
|
|
|
"debug",
|
|
|
|
]
|