Fix loading of docker-compose.override files

Override files are not automatically loaded when running with `-f`, so
we need to specify them manually.
This commit is contained in:
Régis Behmo 2020-01-17 09:41:54 +01:00
parent 6b083fee4e
commit cdc221b20e
3 changed files with 24 additions and 4 deletions

View File

@ -2,6 +2,10 @@
Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Bugfix] Make sure `docker-compose.override.yml` are loaded in dev and local contexts
## 3.11.1 (2020-01-16)
- [Feature] Add `config render` command

View File

@ -1,3 +1,5 @@
import os
import click
from . import compose
@ -10,14 +12,22 @@ from .. import utils
class DevContext(Context):
@staticmethod
def docker_compose(root, config, *command):
return utils.docker_compose(
args = [
"-f",
tutor_env.pathjoin(root, "local", "docker-compose.yml"),
]
override_path = tutor_env.pathjoin(root, "local", "docker-compose.override.yml")
if os.path.exists(override_path):
args += ["-f", override_path]
args += [
"-f",
tutor_env.pathjoin(root, "dev", "docker-compose.yml"),
"--project-name",
config["DEV_PROJECT_NAME"],
*command,
]
override_path = tutor_env.pathjoin(root, "dev", "docker-compose.override.yml")
if os.path.exists(override_path):
args += ["-f", override_path]
return utils.docker_compose(
*args, "--project-name", config["DEV_PROJECT_NAME"], *command,
)

View File

@ -1,3 +1,4 @@
import os
from textwrap import indent
import click
@ -15,9 +16,14 @@ from .. import utils
class LocalContext(Context):
@staticmethod
def docker_compose(root, config, *command):
args = []
override_path = tutor_env.pathjoin(root, "local", "docker-compose.override.yml")
if os.path.exists(override_path):
args += ["-f", override_path]
return utils.docker_compose(
"-f",
tutor_env.pathjoin(root, "local", "docker-compose.yml"),
*args,
"--project-name",
config["LOCAL_PROJECT_NAME"],
*command