From 166fe374b61eb901c44e5de2dd97ca7f02d69719 Mon Sep 17 00:00:00 2001 From: Oleksiy Protas Date: Mon, 17 Oct 2016 01:05:05 +0300 Subject: [PATCH] More explicit logging and 'dockerfile' option support --- plugins/providers/docker/action/build.rb | 23 ++++++++++++++++++----- templates/locales/providers_docker.yml | 4 ++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/plugins/providers/docker/action/build.rb b/plugins/providers/docker/action/build.rb index 34d25827e..cb03f8ba0 100644 --- a/plugins/providers/docker/action/build.rb +++ b/plugins/providers/docker/action/build.rb @@ -43,14 +43,27 @@ module VagrantPlugins args = machine.provider_config.build_args.clone if machine.provider_config.dockerfile dockerfile = machine.provider_config.dockerfile - dockerfile_path = File.join(build_dir, dockerfile) + dockerfile_path = build_dir ? File.join(build_dir, dockerfile) : dockerfile args.push("--file").push(dockerfile_path) - machine.ui.output( - I18n.t("docker_provider.building_named_dockerfile", - file: machine.provider_config.dockerfile)) + if build_dir + machine.ui.output( + I18n.t("docker_provider.building_named_dockerfile", + file: machine.provider_config.dockerfile)) + else + machine.ui.output( + I18n.t("docker_provider.building_git_repo_named_dockerfile", + file: machine.provider_config.dockerfile, + repo: git_repo)) + end else - machine.ui.output(I18n.t("docker_provider.building")) + if build_dir + machine.ui.output(I18n.t("docker_provider.building")) + else + machine.ui.output( + I18n.t("docker_provider.building_git_repo", + repo: git_repo)) + end end image = machine.provider.driver.build( diff --git a/templates/locales/providers_docker.yml b/templates/locales/providers_docker.yml index df1fa2ceb..99aefd370 100644 --- a/templates/locales/providers_docker.yml +++ b/templates/locales/providers_docker.yml @@ -12,8 +12,12 @@ en: Build image no longer exists. Rebuilding... building: |- Building the container from a Dockerfile... + building_git_repo: |- + Building the container from the git repository: %{repo}... building_named_dockerfile: |- Building the container from the named Dockerfile: %{file}... + building_git_repo_named_dockerfile: |- + Building the container from the named Dockerfile: %{file} in the git repository: %{repo}... creating: |- Creating the container... created: |-