-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudbuild.yaml
41 lines (35 loc) · 1.06 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
40
41
steps:
# Build the Go binary
- name: 'golang:1.23'
entrypoint: 'go'
args: ['build', '-o', 'server', '.']
# Run tests
- name: 'golang:1.23'
entrypoint: 'go'
args: ['test', '-v', './...']
# Build Docker image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/$PROJECT_ID/discogs-spotify:$SHORT_SHA', '.']
# Push Docker image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/$PROJECT_ID/discogs-spotify:$SHORT_SHA']
# Deploy to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
args:
- 'run'
- 'deploy'
- 'discogs-spotify'
- '--image'
- 'gcr.io/$PROJECT_ID/discogs-spotify:$SHORT_SHA'
- '--set-secrets'
- 'SPOTIFY_CLIENT_ID=SPOTIFY_CLIENT_ID:latest,SPOTIFY_CLIENT_SECRET=SPOTIFY_CLIENT_SECRET:latest,SESSION_KEY=SESSION_KEY:latest,SPOTIFY_REDIRECT_URI=SPOTIFY_REDIRECT_URI:latest'
- '--region'
- 'europe-west1'
- '--platform'
- 'managed'
- '--set-env-vars'
- 'GIN_MODE=release,ENV=production'
images:
- 'gcr.io/$PROJECT_ID/discogs-spotify:$SHORT_SHA'
options:
logging: CLOUD_LOGGING_ONLY