github.com/askholme/packer@v0.7.2-0.20140924152349-70d9566a6852/Vagrantfile (about)

     1  # -*- mode: ruby -*-
     2  # vi: set ft=ruby :
     3  
     4  # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
     5  VAGRANTFILE_API_VERSION = "2"
     6  
     7  $script = <<SCRIPT
     8  SRCROOT="/opt/go"
     9  
    10  # Install Go
    11  sudo apt-get update
    12  sudo apt-get install -y build-essential mercurial
    13  sudo hg clone -u release https://code.google.com/p/go ${SRCROOT}
    14  cd ${SRCROOT}/src
    15  sudo ./all.bash
    16  
    17  # Setup the GOPATH
    18  sudo mkdir -p /opt/gopath
    19  cat <<EOF >/tmp/gopath.sh
    20  export GOPATH="/opt/gopath"
    21  export PATH="/opt/go/bin:\$GOPATH/bin:\$PATH"
    22  EOF
    23  sudo mv /tmp/gopath.sh /etc/profile.d/gopath.sh
    24  sudo chmod 0755 /etc/profile.d/gopath.sh
    25  
    26  # Make sure the gopath is usable by vagrant
    27  sudo chown -R vagrant:vagrant $SRCROOT
    28  sudo chown -R vagrant:vagrant /opt/gopath
    29  
    30  # Install some other stuff we need
    31  sudo apt-get install -y curl git-core zip
    32  SCRIPT
    33  
    34  Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    35    config.vm.box = "chef/ubuntu-12.04"
    36  
    37    config.vm.provision "shell", inline: $script
    38  
    39    config.vm.synced_folder ".", "/vagrant", disabled: true
    40  
    41    ["vmware_fusion", "vmware_workstation"].each do |p|
    42      config.vm.provider "p" do |v|
    43        v.vmx["memsize"] = "2048"
    44        v.vmx["numvcpus"] = "2"
    45        v.vmx["cpuid.coresPerSocket"] = "1"
    46      end
    47    end
    48  end