diff --git a/README.md b/README.md index 8664166..a3df4e3 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ See `requirements.txt` ## Configuration Options - `loglevel`: (optional) define loglevel. Defaults to "INFO" if not set. +- `compose-opts`: (optional) define additional parameters to `docker compose up -d`. - `stacks`: an array containing details for each repository. Each element is a dictionary containing the following keys: - `dir`: the directory of the repository on your local machine. - `compose-files`: (optional) array of paths (relative to `dir`) to docker-compose files. Uses `["docker-compose.yml"]` by default if not set. diff --git a/config.yml.example b/config.yml.example index b1ff0b4..a277ca8 100644 --- a/config.yml.example +++ b/config.yml.example @@ -1,4 +1,5 @@ -loglevel: "INFO" # optional +loglevdel: "INFO" # optional +compose-opts: "--dry-run" stacks: - dir: /path/to/first-repo - dir: /path/to/second-repo diff --git a/dc-ops b/dc-ops index a4f7c8f..92805cd 100755 --- a/dc-ops +++ b/dc-ops @@ -21,6 +21,9 @@ with configfile.open("r") as f: loglevel = cfg.get("loglevel", "INFO").upper() log.basicConfig(format="%(message)s", level=loglevel) +# define docker compose parameters +composeopts = cfg.get("compose-opts", "") + # iterate all stacks for stack in cfg["stacks"]: # skip disabled stacks @@ -45,7 +48,7 @@ for stack in cfg["stacks"]: composefiles = stack.get("compose-files", ["docker-compose.yml"]) for composefile in composefiles: if not run_subprocess( - f"docker compose --file {composefile} up --build --detach --remove-orphans", # noqa + f"docker compose --file {composefile} up --detach {composeopts}", stackdir, ): pass