providers/docker: build output [GH-3739]
This commit is contained in:
parent
097886b2ce
commit
b656bf4ae5
|
@ -10,6 +10,7 @@ IMPROVEMENTS:
|
|||
- guests/suse: Support NFS client install, rsync setup. [GH-4492]
|
||||
- guests/tinycore: Support changing host names. [GH-4469]
|
||||
- guests/windows: Hostname can be set without reboot. [GH-4687]
|
||||
- providers/docker: Build output is now shown. [GH-3739]
|
||||
- providers/docker: Can now start containers from private repositories
|
||||
more easily. Vagrant will login for you if you specify auth. [GH-4042]
|
||||
- providers/docker: `stop_timeout` can be used to modify the `docker stop`
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
require "log4r"
|
||||
|
||||
require "vagrant/util/ansi_escape_code_remover"
|
||||
|
||||
module VagrantPlugins
|
||||
module DockerProvider
|
||||
module Action
|
||||
class Build
|
||||
include Vagrant::Util::ANSIEscapeCodeRemover
|
||||
|
||||
def initialize(app, env)
|
||||
@app = app
|
||||
@logger = Log4r::Logger.new("vagrant::docker::build")
|
||||
|
@ -37,9 +41,13 @@ module VagrantPlugins
|
|||
machine.ui.output(I18n.t("docker_provider.building"))
|
||||
image = machine.provider.driver.build(
|
||||
build_dir,
|
||||
extra_args: machine.provider_config.build_args,
|
||||
)
|
||||
machine.ui.detail("Image: #{image}")
|
||||
extra_args: machine.provider_config.build_args) do |type, data|
|
||||
data = remove_ansi_escape_codes(data.chomp).chomp
|
||||
env[:ui].detail(data) if data != ""
|
||||
end
|
||||
|
||||
# Output the final image
|
||||
machine.ui.detail("\nImage: #{image}")
|
||||
|
||||
# Store the image ID
|
||||
image_file.open("w") do |f|
|
||||
|
|
|
@ -14,10 +14,10 @@ module VagrantPlugins
|
|||
@executor = Executor::Local.new
|
||||
end
|
||||
|
||||
def build(dir, **opts)
|
||||
def build(dir, **opts, &block)
|
||||
args = Array(opts[:extra_args])
|
||||
args << dir
|
||||
result = execute('docker', 'build', *args)
|
||||
result = execute('docker', 'build', *args, &block)
|
||||
matches = result.scan(/Successfully built (.+)$/i)
|
||||
if matches.empty?
|
||||
# This will cause a stack trace in Vagrant, but it is a bug
|
||||
|
|
Loading…
Reference in New Issue