- Select or create a Google Cloud project.
- Enable billing for your project.
- Enable the Cloud Build API.
- Install and initialize the Cloud SDK.
To use a community-contributed Docker image as a build step, you need to download the source code from this repo and build the image.
The example below shows how to download and build the image for the packer
build step on a Linux or Mac OS X workstation:
-
Clone the
cloud-builders-community
repo:$ git clone(https://github.com/Aswanidevm/examples.git)
-
Go to the directory that has the source code for the
packer
Docker image:$ cd examples/packer
-
Build the Docker image:
$ gcloud builds submit --config cloudbuild.yaml .
-
View the image in Google Container Registry:
$ gcloud container images list --filter packer
Once you've built the Docker image, you can use it as a build step in a Cloud Build build.
For example, below is the packer
build step in a YAML
config file, ready to be used in a Cloud Build build:
- name: 'gcr.io/$PROJECT_ID/packer'
args:
- build
- -var
- project_id=$PROJECT_ID
- packer.json
Each build step's examples
directory has an example of how you can use the build step. See the
example for the packer
builder.