-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudbuild.yaml
31 lines (29 loc) · 935 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
25
26
27
28
29
30
31
steps:
- name: 'gcr.io/cloud-builders/docker'
args:
[
'build',
'-t',
'us-central1-docker.pkg.dev/$PROJECT_ID/uptime-checker/image:latest',
'-t',
'us-central1-docker.pkg.dev/$PROJECT_ID/uptime-checker/image:$COMMIT_SHA',
'--build-arg',
'UPTIME_CHECKER_GIT_REVISION=$COMMIT_SHA',
'--build-arg',
'BUILDKIT_INLINE_CACHE=1',
'--cache-from',
'us-central1-docker.pkg.dev/$PROJECT_ID/uptime-checker/image:latest',
'.',
]
env: [DOCKER_BUILDKIT=1]
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
# Only push "latest" tag when building on "main"
[ "$BRANCH_NAME" != "main" ] && exit 0
docker push us-central1-docker.pkg.dev/$PROJECT_ID/uptime-checker/image:latest
images: [
'us-central1-docker.pkg.dev/$PROJECT_ID/uptime-checker/image:$COMMIT_SHA',
]