This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
69 lines (56 loc) · 2.14 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.provider "virtualbox" do |v|
v.memory = 3072
v.cpus = 2
v.name = "gameontext-sweep"
end
#fix 'stdin is not a tty' output.
config.vm.provision :shell, inline: "(grep -q -E '^mesg n$' /root/.profile && sed -i 's/^mesg n$/tty -s \\&\\& mesg n/g' /root/.profile && echo 'Ignore the previous error about stdin not being a tty. Fixing it now...') || exit 0;"
# Run as Root -- install git, ibmcloud cli, node
config.vm.provision :shell, :inline => <<-EOT
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
curl -sL https://deb.nodesource.com/setup_6.x -o node_setup
bash node_setup
rm node_setup
echo 'Installing Git, Curl, & Nodejs'
apt-get install -y \
git \
curl \
jq \
nodejs \
zip
if /usr/local/bin/ibmcloud > /dev/null 2>/dev/null
then
echo 'Updating IBM Cloud CLI'
/usr/local/bin/ibmcloud update
else
echo 'Installing IBM Cloud CLI'
curl -sL https://ibm.biz/idt-installer | bash
fi
EOT
# Run as vagrant user (not yet in docker group): ibmcloud plugins, profile script
config.vm.provision :shell, privileged: false, :inline => <<-EOT
# don't put global npm modules in /usr/lib
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
# Indicate this is a vagrant VM
echo 'export USE_VAGRANT=true' | tee -a /home/vagrant/.profile
# By default this working directory is mapped to /vagrant,
# automatically change directories on login
echo 'cd /vagrant' | tee -a /home/vagrant/.profile
echo '/vagrant/bin/wsk-setup.sh' | tee -a /home/vagrant/.profile
echo 'export PATH=~/.npm-global/bin:/vagrant/bin:$PATH' | tee -a /home/vagrant/.bashrc
cd /vagrant
EOT
# Run as vagrant user: Always start things
config.vm.provision :shell, privileged: false, run: "always", :inline => <<-EOT
bin/update-plugins.sh
echo 'To work on the sweep :'
echo '> vagrant ssh'
echo '> '
EOT
end