-
Notifications
You must be signed in to change notification settings - Fork 4
/
Vagrantfile
53 lines (45 loc) · 1.51 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 :
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
sudo apt-get -y purge docker-engine
bash <(curl -fsSL https://get.docker.com/)
# 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/mysql:5.5 --no-cache=true 5.5
docker tag nanobox/mysql:5.5 nanobox/mysql:5.5
docker build -t nanobox/mysql:5.6 --no-cache=true 5.6
docker tag nanobox/mysql:5.6 nanobox/mysql:5.6
docker build -t nanobox/mysql:5.7 --no-cache=true 5.7
docker tag nanobox/mysql:5.7 nanobox/mysql:5.7
SCRIPT
end