-
Notifications
You must be signed in to change notification settings - Fork 413
/
Vagrantfile
53 lines (47 loc) · 2.27 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
ROOT = File.dirname(File.expand_path(__FILE__))
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = '2'
# Default env properties which can be overridden
# Example overrides:
# echo "ENV['BASEIMAGE_PATH'] ||= '../../phusion/baseimage-docker' " >> ~/.vagrant.d/Vagrantfile
# echo "ENV['BASE_BOX_URL'] ||= 'd\:/dev/vm/vagrant/boxes/phusion/'" >> ~/.vagrant.d/Vagrantfile
BASE_BOX_URL = ENV['BASE_BOX_URL'] || 'https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/'
VAGRANT_BOX_URL = ENV['VAGRANT_BOX_URL'] || BASE_BOX_URL + 'ubuntu-14.04-amd64-vbox.box'
VMWARE_BOX_URL = ENV['VMWARE_BOX_URL'] || BASE_BOX_URL + 'ubuntu-14.04-amd64-vmwarefusion.box'
PASSENGER_DOCKER_PATH = ENV['PASSENGER_DOCKER_PATH'] || '.'
BASEIMAGE_PATH = ENV['BASEIMAGE_PATH'] || '../baseimage-docker'
DOCKERIZER_PATH = ENV['DOCKERIZER_PATH'] || '../dockerizer'
$script = <<SCRIPT
set -ex
wget -q -O - https://get.docker.io/gpg | apt-key add -
echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
apt-get update -qq
apt-get install -q -y --force-yes lxc-docker
usermod -a -G docker vagrant
docker version
su - vagrant -c 'echo alias d=docker >> ~/.bash_aliases'
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'phusion-open-ubuntu-14.04-amd64'
config.vm.box_url = VAGRANT_BOX_URL
config.ssh.forward_agent = true
passenger_docker_path = File.absolute_path(PASSENGER_DOCKER_PATH, ROOT)
if File.directory?(passenger_docker_path)
config.vm.synced_folder passenger_docker_path, '/vagrant/passenger-docker'
end
baseimage_path = File.absolute_path(BASEIMAGE_PATH, ROOT)
if File.directory?(baseimage_path)
config.vm.synced_folder File.expand_path(baseimage_path), '/vagrant/baseimage-docker'
end
dockerizer_path = File.absolute_path(DOCKERIZER_PATH, ROOT)
if File.directory?(dockerizer_path)
config.vm.synced_folder File.expand_path(dockerizer_path), '/vagrant/dockerizer'
end
config.vm.provider :vmware_fusion do |f, override|
override.vm.box_url = VMWARE_BOX_URL
f.vmx['displayName'] = 'passenger-docker'
end
config.vm.provision :shell, :inline => $script
end