-
Notifications
You must be signed in to change notification settings - Fork 186
/
cloudbuild-discord-bot.yaml
57 lines (51 loc) · 1.81 KB
/
cloudbuild-discord-bot.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
# lit.dev Cloud Build config for discord bot deployment.
# This is triggered manually.
#
# https://cloud.google.com/cloud-build/docs/build-config
steps:
# Build Docker image.
#
# https://docs.docker.com/engine/reference/commandline/build/
# https://github.com/GoogleCloudPlatform/cloud-builders/tree/master/docker
# https://cloud.google.com/build/docs/kaniko-cache
- id: build
# Kaniko pinned to earlier version due to
# https://github.com/GoogleContainerTools/kaniko/issues/1786
name: gcr.io/kaniko-project/executor:v1.6.0
args:
- --dockerfile=./Dockerfile-discord-bot
- --destination=$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/lit-dev-discord-bot:$COMMIT_SHA
- --cache=true
- --cache-ttl=168h # 1 week
# Create a new Cloud Run revision for the discord bot.
#
# https://cloud.google.com/sdk/gcloud/reference/beta/run/deploy
# https://github.com/GoogleCloudPlatform/cloud-sdk-docker
- id: deploy-discord-bot
name: gcr.io/google.com/cloudsdktool/cloud-sdk
entrypoint: gcloud
args:
- beta
- run
- deploy
- lit-dev-discord-bot # Service name
- '--region=$_DEPLOY_REGION'
- '--platform=managed'
- '--image=$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/lit-dev-discord-bot:$COMMIT_SHA'
- '--quiet'
- '--tag=main-$SHORT_SHA'
# IMPORTANT: If you change --memory, be sure to also change
# --max-old-space-size in ./Dockerfile-discord-bot, and this same flag in
- '--memory=1Gi'
- '--cpu=1'
- '--concurrency=default' # unlimited
- '--min-instances=1'
- '--max-instances=1'
- '--set-secrets=BOT_CLIENT_SECRET=lit-dev-discord-bot-token:1'
# TODO(augustjk) Consider adding a step here to delete the old revision
tags:
- lit-dev
- discord-bot
options:
machineType: 'N1_HIGHCPU_8'
timeout: 45m