-
Notifications
You must be signed in to change notification settings - Fork 15
/
Vagrantfile
70 lines (57 loc) · 1.83 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", "2048", "--ioapic", "on"]
end
config.vm.synced_folder ".", "/vagrant"
# ssh keys
config.vm.synced_folder "~/.ssh", "/var/.ssh"# , type: "nfs"
# install docker
config.vm.provision "shell", inline: <<-SCRIPT
if [[ ! `which docker > /dev/null 2>&1` ]]; then
# add docker's gpg key
apt-key adv \
--keyserver hkp://p80.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
# add the source to our apt sources
echo \
"deb https://apt.dockerproject.org/repo ubuntu-trusty main \n" \
> /etc/apt/sources.list.d/docker.list
# update the package index
apt-get -y update
# ensure the old repo is purged
apt-get -y purge lxc-docker
# install docker
apt-get -y install docker-engine
fi
SCRIPT
# start docker
config.vm.provision "shell", inline: <<-SCRIPT
if [[ ! `service docker status | grep "start/running"` ]]; then
# start the docker daemon
service docker start
fi
SCRIPT
# wait for docker to be running
config.vm.provision "shell", inline: <<-SCRIPT
echo "Waiting for docker sock file"
while [ ! -S /var/run/docker.sock ]; do
sleep 1
done
SCRIPT
# pull the build image to run tests in
config.vm.provision "shell", inline: <<-SCRIPT
echo "Pulling the build image"
docker pull nanobox/build
SCRIPT
# copy the ssh keys
config.vm.provision "shell", inline: <<-SCRIPT
echo "Copying SSH keys"
mkdir -p /home/vagrant/ssh
cp /var/.ssh/id_rsa /home/vagrant/ssh
cp /var/.ssh/id_rsa.pub /home/vagrant/ssh
chown -R vagrant /home/vagrant/ssh
SCRIPT
end