-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
35 lines (32 loc) · 806 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
32
33
34
35
# Copy and paste this cloudbuild.yaml into your project to speed up your builds!
# TODO GC unused images
steps:
# Populate the cache
- name: gcr.io/cloud-builders/docker
entrypoint: bash
args:
- -ce
- |
for image in \
gcr.io/$PROJECT_ID/$REPO_NAME:$BRANCH_NAME \
gcr.io/$PROJECT_ID/$REPO_NAME:master \
; do
docker pull $$image || true
done
# Build an image
- name: gcr.io/cloud-builders/docker
args:
- build
- --cache-from
- gcr.io/$PROJECT_ID/$REPO_NAME:$BRANCH_NAME
- --cache-from
- gcr.io/$PROJECT_ID/$REPO_NAME:master
- -t
- gcr.io/$PROJECT_ID/$REPO_NAME:$BRANCH_NAME
- -t
- gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA
- .
# Publish the image
images:
- gcr.io/$PROJECT_ID/$REPO_NAME:$BRANCH_NAME
- gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA