Skip to main content

Templating wrapper for docker-compose

Project description

# meta-compose

This package aims to solve the problem of variable substitution in
docker-compose files by parsing them as [Jinja2](http://jinja.pocoo.org/)
template.

It was inspired by the discussion
[here](https://github.com/docker/compose/issues/1377)

It supports variable declaration in a separate YAML file as well as
access to environment variables.

## Quickstart:

- Install with `pip install meta-compose`

- Create a file `meta-compose.yml` that is a [Jinja2](http://jinja.pocoo.org/)
template for a docker compose file.

- [Optional] Create a file `meta-compose-data.yml` that contains the variables
used in the template that are not environment variables.

- Call `meta-compose` and it will create a docker-compose.yml in the current
directory

## Usage

```
usage: meta-compose [-h] [-d DATAFILE] [-t TEMPLATE] [-o OUTPUTFILE]

optional arguments:
-h, --help show this help message and exit
-d DATAFILE, --datafile DATAFILE
Use to specify data files in addition to meta-compose-
data.yml. They must be JSON or YAML files.
-t TEMPLATE, --template TEMPLATE
Use to specify the template file to use. Defaults to
./meta-compose.yml
-o OUTPUTFILE, --outputfile OUTPUTFILE
Use to specify the output file to create. Defaults to
./docker-compose.yml
```

## Syntax of meta-compose.yml

- Everything in basic [Jinja2](http://jinja.pocoo.org/) is allowed.

- To access environment variables use `{{'default'| env('VARIABLE_NAME')}}`
where `VARIABLE_NAME` is the name of your environment variable and `default`
is the default value you want it to be if the environment variable is not set.

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

meta-compose-0.1.3.tar.gz (6.9 kB view details)

Uploaded Source

File details

Details for the file meta-compose-0.1.3.tar.gz.

File metadata

  • Download URL: meta-compose-0.1.3.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for meta-compose-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c0ec95c6f458aff7605ae3e7f288d16e794772ea02fefabe136b796bdaaab655
MD5 1e8e2839074f9c6078b79b2aa2c72d0c
BLAKE2b-256 6d60baccd452530a520523265f84c262f6780941a811a17ca5dd232e1780d668

See more details on using hashes here.

Supported by

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