-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
24 lines (21 loc) · 985 Bytes
/
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
steps:
# Step 1: Compile the Go Application
- name: 'gcr.io/cloud-builders/go'
id: 'Compile application'
env: ['GOPATH=/gopath']
args: ['build', '-o', 'main', 'main.go']
# Step 2: Build the Docker image for the Go application
- name: 'gcr.io/cloud-builders/docker'
id: 'Build Docker image'
args: ['build', '-t', '<your-region>-docker.pkg.dev/$PROJECT_ID/dissertation-repository/hello-cloudbuild:v1.0', '.']
# Step 3: Push the Docker image to Artifact Registry
- name: 'gcr.io/cloud-builders/docker'
id: 'Push Docker image'
args: ['push', '<your-region>-docker.pkg.dev/$PROJECT_ID/dissertation-repository/hello-cloudbuild:v1.0']
# Step 4: Apply the production deployment YAML file to the production namespace
- name: 'gcr.io/cloud-builders/kubectl'
id: 'Deploy'
args: ['-n', 'prod', 'apply', '-f', 'prod/deployment.yaml']
env:
- 'CLOUDSDK_COMPUTE_REGION=<your-zone>'
- 'CLOUDSDK_CONTAINER_CLUSTER=dissertation-cluster'