Skip to main content

A tool to build/help deploy docker containers. Make for docker.

Project description

DoBuild
=======

Docker Container Builder
------------------------

`dobuild` builds your project's containers specified by a compose-like yaml file.
`dotempl` templates files (eg. Dockerfiles, docker-stack.yaml's) based on the environment.


Installing
----------

git clone <this repo>
pipsi install ./dostack


Features
--------

- Build multiple containers with one command
- Control order of builds with inter-container dependencies
- Templating Dockerfiles, e.g. so that one container can FROM another without having to edit Dockerfile each build


Getting Started
---------------

Create a `dobuild.yaml` file in your project root, with a structure like this:

containers:
pinger:
context: ./docker/pinger
dockerfile: ./docker/pinger/Dockerfile.t

hello:
context: .
dockerfile: ./docker/hello/Dockerfile.t

hello2:
context: ./docker/hello2
dockerfile: ./docker/hello2/Dockerfile.t
depends_on:
- hello

This example defines three containers to be built, *pinger*, *hello* and *hello2*. Here we have declared that *hello2* depends on *hello*, so *hello* will always be built before *hello2*.

Now to build your containers, run

dobuild

And watch it happen! `dobuild` runs `docker build` under the hood for you, so the output will be familiar.

If for example, you only want to a build specific container (and it's dependencies), you can use:

dobuild hello2

which will build *hello2* (and *hello* as it's a dependency), but not *pinger*.

Templates
---------

`dobuild` templates your Dockerfiles using [moustache](https://mustache.github.io/mustache.5.html) templates.

For example, the Dockerfile for *hello2* above:

FROM {{ containers.hello }}
RUN echo "Building {{ containers.hello2 }}"
ENTRYPOINT echo Hello, World, 2!

You can use `{{ containers.<name> }}` to refer to the uri of any container in the project in the current build. Other available tags:

- `{{ docker.registry }}` The docker registry added to container URIs, if defined.
- `{{ docker.prefix }}` The prefix added to container URIs, if defined.

Container URIs (Tags)
---------------------

After building your containers, `dobuild` will tag them with meaningful names composed of a registry, prefix and the container name.

For example, running:

dobuild hello \
--registry registry.example.com \
--prefix owner/helloworld

Will build and tag the image with URI `registry.example.com/owner/helloworld/hello`.

Pushing to a Registry
---------------------

If you add the `--push` flag, and all containers built successfully, `dobuild` will push the containers to the specified registry.

Environment Variables
---------------------

Options can also be specified in environment variables. Note that options on the command line override the environment.

DOBUILD_FILE=./dobuild.yaml # Path to dobuild.yaml
DOBUILD_REGISTRY=registry.example.com # Docker registry
DOBUILD_PREFIX=owner/helloworld # Container URI prefix
DOBUILD_PUSH=True # Push containers after building

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dostack-0.5.4.tar.gz (5.7 kB view details)

Uploaded Source

File details

Details for the file dostack-0.5.4.tar.gz.

File metadata

  • Download URL: dostack-0.5.4.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dostack-0.5.4.tar.gz
Algorithm Hash digest
SHA256 0a6f29c0e5981b744e77089b7deccd066fe52a5d3bded20cfbc3e1855dae4b0a
MD5 a74c4c5a67bd06d763ec9efb2f174a75
BLAKE2b-256 394bcbd2e7c84584a3d6f755800d14e54c6aea6b8e2c2b8aa370e69df32c9ced

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page