-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudbuild.prod.yaml
79 lines (69 loc) · 1.66 KB
/
cloudbuild.prod.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
steps:
- id: "Installing docker-compose"
name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/docker-compose:latest'
- '.'
- id: "Running docker-compose"
name: 'gcr.io/$PROJECT_ID/docker-compose'
args: ['-f','docker-compose.yaml','up','-d','--build']
- id: "Running ps"
name: 'gcr.io/cloud-builders/docker'
args:
- 'ps'
- id: "Running migrations"
name: 'gcr.io/cloud-builders/docker'
args:
- 'exec'
- '-t'
- 'app'
- 'php'
- '/var/www/artisan'
- 'migrate'
- id: "Running tests"
name: 'gcr.io/cloud-builders/docker'
args:
- 'exec'
- '-t'
- 'app'
- 'php'
- '/var/www/vendor/bin/phpunit'
- '-c'
- '/var/www/phpunit.xml'
- id: "Removing .env"
name: 'gcr.io/cloud-builders/docker'
args:
- 'exec'
- '-t'
- 'app'
- 'rm'
- '-f'
- '-f'
- '/var/www/.env'
- id: "Rename image"
name: 'gcr.io/cloud-builders/docker'
args: ['tag', 'workspace_app:latest', 'gcr.io/$PROJECT_ID/sso:$SHORT_SHA']
- id: "Pushing Image"
name: 'gcr.io/cloud-builders/docker'
args: ['push','gcr.io/$PROJECT_ID/sso:$SHORT_SHA']
- id: Ajust deployment for kubectl
name: 'gcr.io/cloud-builders/gcloud'
entrypoint: '/bin/sh'
args:
- '-c'
- |
sed 's#img-app-deployment#gcr.io/$PROJECT_ID/sso:$SHORT_SHA#g' ./k8s/app-deployment.yaml > k8s/app-deployment-new.yaml;
cat k8s/app-deployment-new.yaml;
- id: "Deploying to kubernetes"
name: 'gcr.io/cloud-builders/kubectl'
args:
- 'apply'
- '-f'
- 'k8s/app-deployment-new.yaml'
env:
- 'CLOUDSDK_COMPUTE_ZONE=us-central1-a'
- 'CLOUDSDK_CONTAINER_CLUSTER=standard-cluster-1'
images:
- 'gcr.io/$PROJECT_ID/docker-compose:latest'