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