-
Notifications
You must be signed in to change notification settings - Fork 10
/
cloudbuild.yaml
47 lines (41 loc) · 1.47 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
42
43
44
45
46
47
steps:
# Login to Docker Hub
- name: "gcr.io/cloud-builders/docker"
entrypoint: "bash"
args: ["-c", "docker login --username=$$USERNAME --password=$$PASSWORD"]
secretEnv: ["USERNAME", "PASSWORD"]
# Build the final stage image - Kaniko takes care caching
- name: "gcr.io/kaniko-project/executor:latest"
args:
- "--cache=true"
- "--cache-ttl=48h"
- "--compressed-caching=false"
- "--cache-copy-layers=true"
- "--destination=gcr.io/$PROJECT_ID/pychunkedgraph:$TAG_NAME"
timeout: 1800s
# TODO: can't figure out how to just re-tag and push to Dockerhub
- name: "gcr.io/cloud-builders/docker"
entrypoint: "bash"
args: ["-c", "docker pull gcr.io/$PROJECT_ID/pychunkedgraph:$TAG_NAME"]
# Additional tag for Dockerhub
- name: "gcr.io/cloud-builders/docker"
entrypoint: "bash"
args:
[
"-c",
"docker tag gcr.io/$PROJECT_ID/pychunkedgraph:$TAG_NAME $$USERNAME/pychunkedgraph:$TAG_NAME",
]
secretEnv: ["USERNAME"]
# Push the final image to Dockerhub
- name: "gcr.io/cloud-builders/docker"
entrypoint: "bash"
args: ["-c", "docker push $$USERNAME/pychunkedgraph:$TAG_NAME"]
secretEnv: ["USERNAME"]
images:
- "gcr.io/$PROJECT_ID/pychunkedgraph:$TAG_NAME"
availableSecrets:
secretManager:
- versionName: projects/$PROJECT_ID/secrets/docker-password/versions/1
env: "PASSWORD"
- versionName: projects/$PROJECT_ID/secrets/docker-username/versions/1
env: "USERNAME"