Supporting a named Dockerfile for Docker 1.5.0
This commit is contained in:
parent
a8dcf92f14
commit
be81f09a60
|
@ -38,10 +38,22 @@ module VagrantPlugins
|
|||
# If we have no image or we're rebuilding, we rebuild
|
||||
if !image || env[:build_rebuild]
|
||||
# Build it
|
||||
machine.ui.output(I18n.t("docker_provider.building"))
|
||||
args = machine.provider_config.build_args.clone
|
||||
if (machine.provider_config.dockerfile)
|
||||
dockerfile = machine.provider_config.dockerfile
|
||||
dockerfile_path = File.join(build_dir, dockerfile)
|
||||
|
||||
args.push "--file=\"#{dockerfile_path}\""
|
||||
machine.ui.output(
|
||||
I18n.t("docker_provider.building_named_dockerfile",
|
||||
file: machine.provider_config.dockerfile))
|
||||
else
|
||||
machine.ui.output(I18n.t("docker_provider.building"))
|
||||
end
|
||||
|
||||
image = machine.provider.driver.build(
|
||||
build_dir,
|
||||
extra_args: machine.provider_config.build_args) do |type, data|
|
||||
extra_args: args) do |type, data|
|
||||
data = remove_ansi_escape_codes(data.chomp).chomp
|
||||
env[:ui].detail(data) if data != ""
|
||||
end
|
||||
|
|
|
@ -17,6 +17,12 @@ module VagrantPlugins
|
|||
# @return [String]
|
||||
attr_accessor :build_dir
|
||||
|
||||
# An optional file name of a Dockerfile to be used when building
|
||||
# the image. This requires Docker >1.5.0.
|
||||
#
|
||||
# @return [String]
|
||||
attr_accessor :dockerfile
|
||||
|
||||
# Additional arguments to pass to `docker run` when creating
|
||||
# the container for the first time. This is an array of args.
|
||||
#
|
||||
|
|
|
@ -12,6 +12,8 @@ en:
|
|||
Build image no longer exists. Rebuilding...
|
||||
building: |-
|
||||
Building the container from a Dockerfile...
|
||||
building_named_dockerfile: |-
|
||||
Building the container from the named Dockerfile: %{file}...
|
||||
creating: |-
|
||||
Creating the container...
|
||||
created: |-
|
||||
|
|
Loading…
Reference in New Issue