forked from marekaf/gke-php-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
29 lines (29 loc) · 1.41 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
substitutions:
_CLOUDSDK_COMPUTE_ZONE: europe-west1-b # default value
_CLOUDSDK_CONTAINER_CLUSTER: test # default value
steps:
- id: 'build nginx image'
name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'eu.gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:$SHORT_SHA', '.']
- id: 'build php image'
name: 'gcr.io/cloud-builders/docker'
args: ['build','-f','Dockerfile-php', '-t', 'eu.gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:php-$SHORT_SHA', '.']
- id: 'push nginx image'
name: 'gcr.io/cloud-builders/docker'
args: ['push', 'eu.gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:$SHORT_SHA']
- id: 'push php image'
name: 'gcr.io/cloud-builders/docker'
args: ['push', 'eu.gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:php-$SHORT_SHA']
- id: 'set nginx image in yamls'
name: 'ubuntu'
args: ['bash','-c','sed -i "s,NGINX_IMAGE_NAME,eu.gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:$SHORT_SHA," k8s/*.yaml']
- id: 'set php image in yamls'
name: 'ubuntu'
args: ['bash','-c','sed -i "s,PHP_IMAGE_NAME,eu.gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:php-$SHORT_SHA," k8s/*.yaml']
- id: kubectl-apply
name: 'gcr.io/cloud-builders/kubectl'
args: ['apply', '-f', 'k8s/']
env:
- 'CLOUDSDK_COMPUTE_ZONE=${_CLOUDSDK_COMPUTE_ZONE}'
- 'CLOUDSDK_CONTAINER_CLUSTER=${_CLOUDSDK_CONTAINER_CLUSTER}'
images: ['eu.gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:$SHORT_SHA', 'eu.gcr.io/$PROJECT_ID/$REPO_NAME/$BRANCH_NAME:php-$SHORT_SHA']