It builds container images locally using Google Cloud Container Builder config file.
Why not just do docker build
? It will be useful to provide an easy way to manage multiple steps builds.
steps:
- name: gcr.io/cloud-builders/docker
args: ["build", "-t", "cb-build", "-f", "Dockerfile.build", "."]
- name: cb-build
args: ["cp", "/go/src/cb/cb", "/workspace"]
- name: gcr.io/cloud-builders/docker
args: ["build", "-t", "cb", "."]
This is an example config file. It will build a golang single binary image of cb
command itself (not useful though).
golang
base image as usual.cb
command from workplace volume.$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
cb latest 05994f135ea4 2 days ago 3.208 MB
cb-build latest 61f9b946f604 2 days ago 680.9 MB
...
go get -u github.com/hiroshi/cb
Make sure you have $GOPATH/bin
in your $PATH
.
cb SOURCE.tar.gz --config CONFIG.(json|yml)
source
field in config will be ignored as well as gcloud alpha container builds create
do. Specify SOURCE as 1st argument.images
field in config will be ignored. The cb
command is intended for local builds so always pushing images are not supposed to be welcome.workspace
with docker volume create
.SOURCE
into the workspace
volume with docker copy
.docker run
an image with volumes /var/run/docker.sock//var/run/docker.sock/
, WORKSPACE_VOLUME:/workspace
.docker build
or anything in container with SOURCE at hand.steps
field of CONFIG.Do you get it? No? See and run examples, I hope it may help you understand.
make run-example
wait_for
and id
fields of steps