feat: add cloudbuild.yaml generation for new apps
This commit is contained in:
42
internal/serv/tmpl/cloudbuild.yaml
Normal file
42
internal/serv/tmpl/cloudbuild.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
steps:
|
||||
# Build image with tag 'latest'
|
||||
- name: "gcr.io/cloud-builders/docker"
|
||||
args:
|
||||
[
|
||||
"build",
|
||||
"--tag",
|
||||
"gcr.io/$PROJECT_ID/{% app_name_slug %}: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/{% app_name_slug %}:latest"]
|
||||
|
||||
# Deploy image to Cloud Run
|
||||
- name: "gcr.io/cloud-builders/gcloud"
|
||||
args:
|
||||
[
|
||||
"run",
|
||||
"deploy",
|
||||
"data",
|
||||
"--image",
|
||||
"gcr.io/$PROJECT_ID/{% app_name_slug %}:latest",
|
||||
"--add-cloudsql-instances",
|
||||
"$PROJECT_ID:$REGION:{% app_name_slug %}_production",
|
||||
"--region",
|
||||
"$REGION",
|
||||
"--platform",
|
||||
"managed",
|
||||
"--update-env-vars",
|
||||
"GO_ENV=production,SG_DATABASE_HOST=/cloudsql/$PROJECT_ID:$REGION:{% app_name_slug %}_production,SECRETS_FILE=prod.secrets.yml",
|
||||
"--port",
|
||||
"8080",
|
||||
"--service-account",
|
||||
"$SERVICE_ACCOUNT",
|
||||
"--allow-unauthenticated",
|
||||
"--verbosity",
|
||||
"debug",
|
||||
]
|
Reference in New Issue
Block a user