Use local cache for example box as well
This commit is contained in:
parent
1e49de0a91
commit
a2108cd362
1 changed files with 13 additions and 0 deletions
13
example/Vagrantfile
vendored
13
example/Vagrantfile
vendored
|
@ -1,6 +1,16 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
def local_cache(box_name)
|
||||
cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),
|
||||
'cache',
|
||||
'apt',
|
||||
box_name)
|
||||
partial_dir = File.join(cache_dir, 'partial')
|
||||
FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir
|
||||
cache_dir
|
||||
end
|
||||
|
||||
Vagrant.require_plugin 'vagrant-lxc'
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
|
@ -10,6 +20,9 @@ Vagrant.configure("2") do |config|
|
|||
|
||||
config.vm.synced_folder "/tmp", "/vagrant_data"
|
||||
|
||||
cache_dir = local_cache(config.vm.box)
|
||||
config.vm.synced_folder cache_dir, "/var/cache/apt/archives"
|
||||
|
||||
config.vm.provider :lxc do |lxc|
|
||||
lxc.lxc_dhcp_ip = '10.0.254.1' if ENV['USER'] == 'vagrant'
|
||||
lxc.start_opts << 'lxc.cgroup.memory.limit_in_bytes=400M'
|
||||
|
|
Loading…
Reference in a new issue