providers/docker: ability to specify build dir synced folder opts [GH-3727]

This commit is contained in:
Mitchell Hashimoto 2014-05-08 18:46:03 -07:00
parent a9029842a6
commit 745bdf6766
5 changed files with 18 additions and 1 deletions

View File

@ -8,6 +8,8 @@ IMPROVEMENTS:
RDP client. [GH-3686] RDP client. [GH-3686]
- providers/docker: `build_args` config to specify extra args for - providers/docker: `build_args` config to specify extra args for
`docker build`. [GH-3684] `docker build`. [GH-3684]
- providers/docker: Can specify options for the build dir synced
folder when a host VM is in use. [GH-3727]
- synced\_folders/nfs: Can tell Vagrant not to handle exporting - synced\_folders/nfs: Can tell Vagrant not to handle exporting
by setting `nfs_export: false` [GH-3636] by setting `nfs_export: false` [GH-3636]

View File

@ -32,7 +32,7 @@ module VagrantPlugins
options = { options = {
docker__ignore: true, docker__ignore: true,
docker__exact: true, docker__exact: true,
} }.merge(machine.provider_config.host_vm_build_dir_options || {})
machine.config.vm.synced_folder(build_dir, new_build_dir, options) machine.config.vm.synced_folder(build_dir, new_build_dir, options)
# Set the build dir to be the correct one # Set the build dir to be the correct one

View File

@ -44,6 +44,11 @@ module VagrantPlugins
# provisioning, etc. # provisioning, etc.
attr_accessor :has_ssh attr_accessor :has_ssh
# Options for the build dir synced folder if a host VM is in use.
#
# @return [Hash]
attr_accessor :host_vm_build_dir_options
# The name for the container. This must be unique for all containers # The name for the container. This must be unique for all containers
# on the proxy machine if it is made. # on the proxy machine if it is made.
# #
@ -87,6 +92,7 @@ module VagrantPlugins
@expose = [] @expose = []
@force_host_vm = UNSET_VALUE @force_host_vm = UNSET_VALUE
@has_ssh = UNSET_VALUE @has_ssh = UNSET_VALUE
@host_vm_build_dir_options = UNSET_VALUE
@image = UNSET_VALUE @image = UNSET_VALUE
@name = UNSET_VALUE @name = UNSET_VALUE
@links = [] @links = []
@ -147,6 +153,10 @@ module VagrantPlugins
@vagrant_machine = nil if @vagrant_machine == UNSET_VALUE @vagrant_machine = nil if @vagrant_machine == UNSET_VALUE
@vagrant_vagrantfile = nil if @vagrant_vagrantfile == UNSET_VALUE @vagrant_vagrantfile = nil if @vagrant_vagrantfile == UNSET_VALUE
if @host_vm_build_dir_options == UNSET_VALUE
@host_vm_build_dir_options = nil
end
# The machine name must be a symbol # The machine name must be a symbol
@vagrant_machine = @vagrant_machine.to_sym if @vagrant_machine @vagrant_machine = @vagrant_machine.to_sym if @vagrant_machine

View File

@ -43,6 +43,7 @@ describe VagrantPlugins::DockerProvider::Config do
its(:cmd) { should eq([]) } its(:cmd) { should eq([]) }
its(:env) { should eq({}) } its(:env) { should eq({}) }
its(:force_host_vm) { should be_false } its(:force_host_vm) { should be_false }
its(:host_vm_build_dir_options) { should be_nil }
its(:image) { should be_nil } its(:image) { should be_nil }
its(:name) { should be_nil } its(:name) { should be_nil }
its(:privileged) { should be_false } its(:privileged) { should be_false }

View File

@ -44,6 +44,10 @@ you may set. A complete reference is shown below.
the container. This allows `vagrant ssh` to work, provisioners, etc. the container. This allows `vagrant ssh` to work, provisioners, etc.
This defaults to false. This defaults to false.
* `host_vm_build_dir_options` (hash) - Synced folder options for the
`build_dir`, since the build directory is synced using a synced folder
if a host VM is in use.
* `name` (string) - Name of the container. Note that this has to be unique * `name` (string) - Name of the container. Note that this has to be unique
across all containers on the host VM. By default Vagrant will generate across all containers on the host VM. By default Vagrant will generate
some random name. some random name.