-
Notifications
You must be signed in to change notification settings - Fork 3
/
cloudbuild.yaml
39 lines (38 loc) · 1.52 KB
/
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
substitutions:
_APP_RUNTIME: quarkus # default value
_APP_RUNTIME_FLAVOUR: jvm # default value
_LOCATION: europe-north1 # default value
steps:
# Build using a specific Dockerfile at a custom path
- name: 'gcr.io/cloud-builders/docker'
args:
- build
- "--tag=${_LOCATION}-docker.pkg.dev/$PROJECT_ID/rndstrs/randomstrings-${_APP_RUNTIME}-${_APP_RUNTIME_FLAVOUR}"
- "--file=./src/main/docker/${_APP_RUNTIME}/Dockerfile.${_APP_RUNTIME_FLAVOUR}"
- .
# Push the container image to Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
args: [ 'push', '${_LOCATION}-docker.pkg.dev/$PROJECT_ID/rndstrs/randomstrings-${_APP_RUNTIME}-${_APP_RUNTIME_FLAVOUR}' ]
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: gcloud
args:
- 'run'
- 'deploy'
- 'randomstrings-${_APP_RUNTIME}-${_APP_RUNTIME_FLAVOUR}'
- '--image'
- '${_LOCATION}-docker.pkg.dev/$PROJECT_ID/rndstrs/randomstrings-${_APP_RUNTIME}-${_APP_RUNTIME_FLAVOUR}:latest'
- '--region'
- '${_LOCATION}'
- '--platform'
- 'managed'
- '--min-instances'
- '0'
- '--max-instances'
- '1'
images: ['${_LOCATION}-docker.pkg.dev/$PROJECT_ID/rndstrs/randomstrings-${_APP_RUNTIME}-${_APP_RUNTIME_FLAVOUR}']
# SUBSTITUTION - example:
# ** Can also be:
# --tag=${_LOCATION}-docker.pkg.dev/$PROJECT_ID/${_REPOSITORY}/${_IMAGE}
# ** And run with:
# gcloud builds submit --config=cloudbuild.yaml \
# --substitutions=_LOCATION="us-east1",_REPOSITORY="my-repo",_IMAGE="my-image"