Skip to main content

Search the Dev Center

Search tutorials, templates, examples, and more.

Build a Docker image with Docker Build Cloud (DBC)

An example that builds a Dockerfile in Docker Build Cloud.

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set dockerbuildcloud-ts
cd pulumi-examples/dockerbuildcloud-ts

Builds a Docker image from a local NGINX Dockerfile using Docker Build Cloud (DBC). This template prompts you for an existing DBC builder.

Prerequisites#

  1. Install Pulumi
  2. Install Node.js
  3. A Docker Build Cloud (DBC) builder — you must complete the DBC builder setup steps
  4. Docker Desktop / CLI
  5. Recommended: a Pulumi Cloud account

Deploying the example#

This Pulumi example is written as a template. It is meant to be copied via pulumi new as follows:

Terminal window
pulumi new https://github.com/pulumi/examples/tree/master/dockerbuildcloud-ts
npm install

Once copied to your machine, feel free to edit as needed.

  1. Create a new stack, which is an isolated deployment target for this example:

    Terminal window
    pulumi stack init dev
  2. Set the name of your existing (and configured) cloud builder:

    Terminal window
    pulumi config set builder cloud-pulumi-my-cool-builder
  3. Install dependencies:

    Terminal window
    npm install
  4. Deploy your infrastructure by running pulumi up and selecting “yes” to confirm the expected changes:

    Terminal window
    pulumi up

Cleaning up#

Once you are done, you can destroy all of the resources, and the stack:

Terminal window
pulumi destroy
pulumi stack rm

Related

The infrastructure as code platform for any cloud.