Skip to content

BuildCompose

Boris Feld edited this page Jun 7, 2019 · 6 revisions

The build-compose command allows you to build multiple images described in a docker-compose.yml file in your target.

⚠️ Only docker compose versions 3 are supported

All images with the build section set will be built. That means your docker-compose.yml file can use external images (like postgresql:latest) that will be skipped, alongside your own images to build.

Arguments

ArgumentTypeDescriptionSample values
--compose-file, -cOptional path, defaults to docker-compose.ymlPath to the docker-compose.yml file in your targetpath/to/docker-compose.yml
--registryOptional string, defaults to env variable REGISTRY or registry.hub.docker.com if not setSets the registry used to tag the images produced. Useful when combining with push-artifactregistry.hub.docker.com
--writeOptional pathDirectory where the produced images will be stored as TAR archives. Used for artifacts uploading/builds/images/
--build-retries, -rOptional positive integer, defaults to 3Number of times each image build will be retried after a failure (network, ...)5
--build-argOptional multiple KEY=VALUE stringsBuild arguments provided to each Docker image built. They need to be namespaced to be efficient across images.BACKEND_VERSION=1.2.3
--tagOptional multiple strings, defaults to latestDocker tags applied on the built image--tag=latest --tag=1.2.3
--serviceOptional multiple stringsLimit the docker-compose file processing to those servcies.my-project

Taskcluster integration

As this command builds a Docker image, you will need the following:

  • scope docker-worker:capability:privileged on your task
  • a worker type that can use the privileged capability (ask a #taskcluster admin)
  • request the priviliged state in your task payload:
payload:
capabilities:
privileged: true

Example

Here is a dummy docker-compose.yml file that would build a single image, tagged mozilla/my-project:latest

version: '3.2'services:
my-project:
build:
context: .dockerfile: infra/dockerfile.baseimage: mozilla/my-projectdatabase:
image: postgresql:latest

Clone this wiki locally