-
Notifications
You must be signed in to change notification settings - Fork 4
/
cloudbuild.prod.yaml
51 lines (42 loc) · 1.62 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
steps:
- id: "Rodando docker-compose"
name: 'gcr.io/$PROJECT_ID/docker-compose:1.24.0'
args: ['-f','docker-compose.cloudbuild.yaml','up','-d']
- id: "Rodando composer"
name: 'gcr.io/cloud-builders/docker'
args: ['exec','-t','app','composer','install']
- id: "Copiando .env"
name: 'gcr.io/cloud-builders/docker'
args: ['exec','-t','app','cp','.env.example','.env']
- id: "Rodando key:generate"
name: 'gcr.io/cloud-builders/docker'
args: ['exec','-t','app','php','/var/www/artisan','key:generate']
- id: "Rodando migrations"
name: 'gcr.io/cloud-builders/docker'
args: ['exec','-t','app','php','/var/www/artisan','migrate']
- id: "Rodando Phpunit"
name: 'gcr.io/cloud-builders/docker'
args: ['exec','-t','app','php','/var/www/vendor/bin/phpunit','-c','/var/www/phpunit.xml']
- id: "Building image from Dockerfile.prod"
name: 'gcr.io/cloud-builders/docker'
args: ['build','-t','gcr.io/$PROJECT_ID/app-laravel:$SHORT_SHA','-f','Dockerfile.prod','.']
- id: "Pushing image"
name: 'gcr.io/cloud-builders/docker'
args: ['push','gcr.io/$PROJECT_ID/app-laravel:$SHORT_SHA']
- id: 'Adjusting deployment file - k8s'
name: 'gcr.io/cloud-builders/gcloud'
entrypoint: '/bin/sh'
args:
- '-c'
- |
sed 's#img-app-deployment#gcr.io/$PROJECT_ID/app-laravel:$SHORT_SHA#g' k8s/app/deployment.yaml > k8s/app/deployment-new.yaml;
cat k8s/app/deployment-new.yaml;
- id: 'Deploying k8s'
name: 'gcr.io/cloud-builders/kubectl'
args:
- 'apply'
- '-f'
- 'k8s/app/deployment-new.yaml'
env:
- 'CLOUDSDK_COMPUTE_ZONE=us-central1-a'
- 'CLOUDSDK_CONTAINER_CLUSTER=cluster-docker-laravel'