mirror of https://github.com/docker/compose.git
Remove duplicate functions
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
13063a96cb
commit
1ae57d92d4
|
@ -457,8 +457,7 @@ def resolve_environment(service_dict):
|
|||
|
||||
|
||||
def resolve_build_args(build):
|
||||
args = {}
|
||||
args.update(parse_build_arguments(build.get('args')))
|
||||
args = parse_build_arguments(build.get('args'))
|
||||
return dict(resolve_env_var(k, v) for k, v in six.iteritems(args))
|
||||
|
||||
|
||||
|
@ -699,6 +698,14 @@ parse_environment = functools.partial(parse_dict_or_list, split_env, 'environmen
|
|||
parse_labels = functools.partial(parse_dict_or_list, split_label, 'labels')
|
||||
|
||||
|
||||
def parse_ulimits(ulimits):
|
||||
if not ulimits:
|
||||
return {}
|
||||
|
||||
if isinstance(ulimits, dict):
|
||||
return dict(ulimits)
|
||||
|
||||
|
||||
def resolve_env_var(key, val):
|
||||
if val is not None:
|
||||
return key, val
|
||||
|
@ -743,13 +750,9 @@ def resolve_volume_path(working_dir, volume):
|
|||
|
||||
|
||||
def normalize_build(service_dict, working_dir):
|
||||
build = {}
|
||||
|
||||
# supported in V1 only
|
||||
if 'dockerfile' in service_dict:
|
||||
build['dockerfile'] = service_dict.pop('dockerfile')
|
||||
|
||||
if 'build' in service_dict:
|
||||
build = {}
|
||||
# Shortcut where specifying a string is treated as the build context
|
||||
if isinstance(service_dict['build'], six.string_types):
|
||||
build['context'] = service_dict.pop('build')
|
||||
|
@ -758,7 +761,6 @@ def normalize_build(service_dict, working_dir):
|
|||
if 'args' in build:
|
||||
build['args'] = resolve_build_args(build)
|
||||
|
||||
if build:
|
||||
service_dict['build'] = build
|
||||
|
||||
|
||||
|
@ -835,32 +837,6 @@ def join_path_mapping(pair):
|
|||
return ":".join((host, container))
|
||||
|
||||
|
||||
def parse_labels(labels):
|
||||
if not labels:
|
||||
return {}
|
||||
|
||||
if isinstance(labels, list):
|
||||
return dict(split_label(e) for e in labels)
|
||||
|
||||
if isinstance(labels, dict):
|
||||
return dict(labels)
|
||||
|
||||
|
||||
def split_label(label):
|
||||
if '=' in label:
|
||||
return label.split('=', 1)
|
||||
else:
|
||||
return label, ''
|
||||
|
||||
|
||||
def parse_ulimits(ulimits):
|
||||
if not ulimits:
|
||||
return {}
|
||||
|
||||
if isinstance(ulimits, dict):
|
||||
return dict(ulimits)
|
||||
|
||||
|
||||
def expand_path(working_dir, path):
|
||||
return os.path.abspath(os.path.join(working_dir, os.path.expanduser(path)))
|
||||
|
||||
|
|
|
@ -228,18 +228,6 @@ Custom DNS search domains. Can be a single value or a list.
|
|||
- dc1.example.com
|
||||
- dc2.example.com
|
||||
|
||||
### dockerfile
|
||||
|
||||
Alternate Dockerfile.
|
||||
|
||||
Compose will use an alternate file to build with. A build path must also be
|
||||
specified using the `build` key.
|
||||
|
||||
build: /path/to/build/dir
|
||||
dockerfile: Dockerfile-alternate
|
||||
|
||||
Using `dockerfile` together with `image` is not allowed. Attempting to do so results in an error.
|
||||
|
||||
### entrypoint
|
||||
|
||||
Override the default entrypoint.
|
||||
|
|
Loading…
Reference in New Issue