forked from brunorijsman/rift-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
52 lines (41 loc) · 1.29 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.5.0"
$install_reqs = <<SCRIPT
apt update
apt-get install -y python3-venv
SCRIPT
$prepare_venv = <<SCRIPT
cd
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install -r /vagrant/requirements.txt
SCRIPT
$venv_on_login = <<SCRIPT
cat <<EOT >> ~/.profile
# activate venv by default
if [ -f ~/venv/bin/activate ]; then
. ~/venv/bin/activate
fi
EOT
# make a symlink to conveniently get to top level
[ -e ~/rift-python ] || ln -s /vagrant ~/rift-python
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "ubuntu" do |ubuntu|
ubuntu.vm.box = "ubuntu/xenial64"
ubuntu.vm.box_check_update = false
ubuntu.vm.hostname = "xenialvm"
ubuntu.vm.provider :virtualbox do |vb|
vb.cpus = 2
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
end
ubuntu.vm.provision "install_reqs", type: "shell", inline: $install_reqs
ubuntu.vm.provision "prepare_venv", type: "shell", inline: $prepare_venv, privileged: false
ubuntu.vm.provision "venv_on_login", type: "shell", inline: $venv_on_login, privileged: false
end
end