-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile-bargee
75 lines (60 loc) · 2.23 KB
/
Vagrantfile-bargee
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
71
72
73
74
75
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Prerequisites validation
## Vagrant version
Vagrant.require_version ">= 1.7.4"
$forwarded_ports = { 80 => 80, 443 => 443}
set_environment_variables = <<SCRIPT
tee "/etc/profile.d/myvars.sh" > "/dev/null" <<EOF
# environment variables.
# change default docker-compose load file name
export COMPOSE_FILE=docker-compose.yml
alias dc='docker-compose'
EOF
SCRIPT
latest_docker_install_script = <<SCRIPT
DOCKER_VERSION=18.06.1-ce
DOCKER_COMPOSE_VERSION=1.23.2
docker version
/etc/init.d/docker restart $DOCKER_VERSION
wget -q -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-`uname -s`-`uname -m`
mv docker-compose-`uname -s`-`uname -m` /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
chown root:root /opt/bin/docker-compose
SCRIPT
run_docker_compose = <<SCRIPT
cd /vagrant
docker-compose down
docker-compose build
docker-compose up -d
SCRIPT
module VagrantPlugins
module GuestLinux
class Plugin < Vagrant.plugin("2")
guest_capability("linux", "change_host_name") { Cap::ChangeHostName }
guest_capability("linux", "configure_networks") { Cap::ConfigureNetworks }
end
end
end
Vagrant.configure("2") do |config|
config.vm.define "barge"
config.vm.box = "ailispaw/barge"
$forwarded_ports.each do |guest, host|
config.vm.network "forwarded_port", guest: guest, host: host, auto_correct: true
end
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
config.vm.synced_folder ".", "/vagrant"
# for NFS synced folder
# config.vm.network "private_network", ip: "192.168.33.10"
# config.vm.synced_folder ".", "/vagrant", type: "nfs"
# mount_options: ["nolock", "vers=3", "udp", "noatime", "actimeo=1"]
# for RSync synced folder
# config.vm.synced_folder ".", "/vagrant", type: "rsync",
# rsync__args: ["--verbose", "--archive", "--delete", "--copy-links"]
config.vm.provision :shell, :inline => latest_docker_install_script
config.vm.provision :shell, :inline => set_environment_variables, run: "always"
config.vm.provision :shell, :inline => run_docker_compose, run: "always"
end