-
Notifications
You must be signed in to change notification settings - Fork 3
/
Vagrantfile
60 lines (52 loc) · 1.67 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
# -*- 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"
# 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" \
> /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
# clean up packages that aren't needed
apt-get -y autoremove
# add the vagrant user to the docker group
usermod -aG docker vagrant
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
# build the docker image
config.vm.provision "shell", inline: <<-SCRIPT
echo "Building docker image..."
cd /vagrant
docker build -t nanobox/influxdb --no-cache=true .
SCRIPT
end