5
Docker workspaces are unique in our world, as they can be one of two context
6
dependent things: A Docker build directory, containing only a single
7
Dockerfile, or they can be part of a formation using docker-compose in which
8
they warehouse a docker-compose.yml file.
10
Under most situations we only care about the context the charm author wishes
11
to be in, and what implications that has on the workspace to be valid.
13
This method simply exposes an overrideable object to determine these
16
def __init__(self, path, context="compose"):
18
self.context = context
27
dcyml = os.path.isfile("{}/docker-compose.yml".format(self.path))
28
dcyaml = os.path.isfile("{}/docker-compose.yaml".format(self.path))
29
dfile = os.path.isfile("{}/Dockerfile".format(self.path))
31
if self.context == "compose":
32
if not dcyml and not dcyaml:
33
msg = "Missing yaml definition: docker-compose.yml"
37
msg = "Missing Dockerfile"