providers/docker: style on custom Dockerfile

This commit is contained in:
Mitchell Hashimoto 2015-07-08 16:07:57 -06:00
parent 8d725c1f27
commit be21604d45
2 changed files with 5 additions and 3 deletions

View File

@ -39,11 +39,11 @@ module VagrantPlugins
if !image || env[:build_rebuild] if !image || env[:build_rebuild]
# Build it # Build it
args = machine.provider_config.build_args.clone args = machine.provider_config.build_args.clone
if (machine.provider_config.dockerfile) if machine.provider_config.dockerfile
dockerfile = machine.provider_config.dockerfile dockerfile = machine.provider_config.dockerfile
dockerfile_path = File.join(build_dir, dockerfile) dockerfile_path = File.join(build_dir, dockerfile)
args.push "--file=\"#{dockerfile_path}\"" args.push("--file=\"#{dockerfile_path}\"")
machine.ui.output( machine.ui.output(
I18n.t("docker_provider.building_named_dockerfile", I18n.t("docker_provider.building_named_dockerfile",
file: machine.provider_config.dockerfile)) file: machine.provider_config.dockerfile))

View File

@ -131,6 +131,7 @@ module VagrantPlugins
@build_dir = UNSET_VALUE @build_dir = UNSET_VALUE
@cmd = UNSET_VALUE @cmd = UNSET_VALUE
@create_args = UNSET_VALUE @create_args = UNSET_VALUE
@dockerfile = UNSET_VALUE
@env = {} @env = {}
@expose = [] @expose = []
@force_host_vm = UNSET_VALUE @force_host_vm = UNSET_VALUE
@ -192,6 +193,7 @@ module VagrantPlugins
@build_dir = nil if @build_dir == UNSET_VALUE @build_dir = nil if @build_dir == UNSET_VALUE
@cmd = [] if @cmd == UNSET_VALUE @cmd = [] if @cmd == UNSET_VALUE
@create_args = [] if @create_args == UNSET_VALUE @create_args = [] if @create_args == UNSET_VALUE
@dockerfile = nil if @dockerfile == UNSET_VALUE
@env ||= {} @env ||= {}
@force_host_vm = false if @force_host_vm == UNSET_VALUE @force_host_vm = false if @force_host_vm == UNSET_VALUE
@has_ssh = false if @has_ssh == UNSET_VALUE @has_ssh = false if @has_ssh == UNSET_VALUE
@ -232,7 +234,7 @@ module VagrantPlugins
if @build_dir if @build_dir
build_dir_pn = Pathname.new(@build_dir) build_dir_pn = Pathname.new(@build_dir)
if !build_dir_pn.directory? || !build_dir_pn.join("Dockerfile").file? if !build_dir_pn.directory?
errors << I18n.t("docker_provider.errors.config.build_dir_invalid") errors << I18n.t("docker_provider.errors.config.build_dir_invalid")
end end
end end