basecamp/docker-compose-buildkite-plugin

Name: docker-compose-buildkite-plugin

Owner: Basecamp

Description: Run build jobs in Docker Compose containers

Forked from: buildkite-plugins/docker-compose-buildkite-plugin

Created: 2016-10-07 13:43:59.0

Updated: 2016-10-07 13:44:00.0

Pushed: 2017-02-02 18:16:29.0

Homepage:

Size: 141

Language: Shell

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Docker Compose Buildkite Plugin

This is designed to run with the upcoming version of 3.0 of Buildkite Agent (currently in beta). Plugins are not yet supported in version 2.1. See the Containerized Builds with Docker guide for running builds in Docker with the current stable version of the Buildkite Agent.

A Buildkite plugin allowing you to create a build system capable of running any project or tool with a Docker Compose config file in its repository.

Example

The following pipeline will run test.sh inside a app service container using Docker Compose, the equivalent to running docker-compose run app test.sh:

s:
command: test.sh
plugins:
  docker-compose:
    run: app

You can also specify a custom Docker Compose config file if you need:

s:
command: test.sh
plugins:
  docker-compose:
    run: app
    config: docker-compose.tests.yml

or multiple config files:

s:
command: test.sh
plugins:
  docker-compose:
    run: app
    config:
      - docker-compose.yml
      - docker-compose.test.yml

Pre-building the image

To speed up run parallel steps you can add a pre-building step to your pipeline, allowing all the run steps to skip image building:

s:
name: ":docker: Build"
plugins:
  docker-compose:
    build: app

wait

name: ":docker: Test %n"
command: test.sh
parallelism: 25
plugins:
  docker-compose:
    run: app

If you?re running agents across multiple machines and Docker hosts you?ll want to push the pre-built image to a docker image repository using the image-repository option. The following example uses this option, along with dedicated builder and runner agent queues:

s:
name: ":docker: Build"
agents:
  queue: docker-builder
plugins:
  docker-compose:
    build: app
    image-repository: index.docker.io/org/repo

wait

name: ":docker: Test %n"
command: test.sh
parallelism: 25
agents:
  queue: docker-runner
plugins:
  docker-compose:
    run: app
Options
build

The name of a service to build and store, allowing following pipeline steps to run faster as they won't need to build the image. The step?s command will be ignored and does not need to be specified.

run

The name of the service the command should be run within. If the docker-compose command would usually be docker-compose run app test.sh then the value would be app.

config (optional)

The file name of the Docker Compose configuration file to use. Can also be a list of filenames.

Default: docker-compose.yml

image-repository (optional)

The repository for pushing and pulling pre-built images, same as the repository location you would use for a docker push, for example "index.docker.io/org/repo". Each image is tagged to the specific build so you can safely share the same image repository for any number of projects and builds.

The default is "" which only builds images on the local Docker host doing the build.

Note: this option only needs to be specified on the build step, and will be automatically picked up by following steps.

This option can also be configured on the agent machine using the environment variable BUILDKITE_PLUGIN_DOCKER_COMPOSE_IMAGE_REPOSITORY.

image-name (optional)

The name to use when tagging pre-built images.

The default is ${BUILDKITE_PIPELINE_SLUG}-${BUILDKITE_PLUGIN_DOCKER_COMPOSE_BUILD}-build-${BUILDKITE_BUILD_NUMBER}, for example my-project-web-build-42.

Note: this option can only be specified on a build step.

Roadmap
License

MIT (see LICENSE)


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.