-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
102 lines (87 loc) · 2.94 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Vagrant configuration for AMPL/MP.
#
# Usage:
# > vagrant up lucid64
# ...
# lucid64: Container created: <container-id>
# ...
# > docker exec -it <container-id> bash
require 'pathname'
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# Path to directory containing optional dependencies.
OPT_DIR = ENV["AMPL_OPT_DIR"]
def configure_docker(config, image, arch)
config.vm.provider "docker" do |d|
d.image = "buildbot:" + image
if OPT_DIR
dir = OPT_DIR + "/linux-" + arch + "/*/"
d.volumes = Pathname.glob(dir).map { |p| p.to_s + ":/opt/" + p.basename.to_s }
end
d.cmd = ["/vagrant/support/buildbot/run-buildslave"]
end
end
def configure_virtualbox(config, cpus, memory, port)
# This requires VirtualBox Extension Pack to be installed on the host.
config.vm.provider "virtualbox" do |v|
v.cpus = cpus
v.memory = memory
v.customize ["modifyvm", :id, "--vrde", "on", "--vrdeauthtype", "external",
"--vrdeport", port.to_s]
end
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Linux boxes don't use provisioning. To update them, use
# support/bootstrap/create-ubuntu-image.py script.
config.vm.define "lucid32" do |c|
configure_docker(c, "lucid32", "i686")
end
config.vm.define "lucid64", primary: true do |c|
configure_docker(c, "lucid64", "x86_64")
end
config.vm.define "precise32" do |c|
configure_docker(c, "precise32", "i686")
end
config.vm.define "precise64" do |c|
configure_docker(c, "precise64", "x86_64")
end
config.vm.define "trusty32" do |c|
configure_docker(c, "trusty32", "i686")
end
config.vm.define "trusty64" do |c|
configure_docker(c, "trusty64", "x86_64")
end
config.vm.define "xenial32" do |c|
configure_docker(c, "xenial32", "i686")
end
config.vm.define "xenial64" do |c|
configure_docker(c, "xenial64", "x86_64")
end
config.vm.define "osx-ml" do |c|
configure_virtualbox(config, 2, 1024, 5000)
c.vm.box = "osx-ml"
c.ssh.insert_key = false
c.vm.network :private_network, ip: "10.11.12.13"
# Options "nolocks" and "locallocks" are required for mounting DMG files
# from an NFS share.
mount_options = ["resvport", "nolocks", "locallocks"]
c.vm.synced_folder ".", "/vagrant", :type => "nfs", :mount_options => mount_options
if OPT_DIR
c.vm.synced_folder OPT_DIR, "/mnt/opt", :type => "nfs", :mount_options => mount_options
end
c.vm.provision :shell, :inline => "/vagrant/support/bootstrap/bootstrap-osx.py"
end
config.vm.define "win2008" do |c|
configure_virtualbox(config, 4, 2048, 5001)
c.vm.box = "win2008"
c.vm.guest = :windows
c.vm.communicator = "winrm"
c.vm.provision :shell, :inline => "\\vagrant\\support\\bootstrap\\bootstrap-windows.bat"
if OPT_DIR
c.vm.synced_folder OPT_DIR, "/opt"
end
end
end