diff --git a/vagrantfile b/vagrantfile new file mode 100644 index 0000000..4ea0db0 --- /dev/null +++ b/vagrantfile @@ -0,0 +1,41 @@ +Vagrant.configure("2") do |config| + + # Every Vagrant virtual environment requires a box to build off of. + config.vm.box = "becorecode/alpinelinux-3.11" + config.vm.box_version = "1.0.0" + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. + # By connecting to localhost:8080 from the host, we can access the guest's + # webserver. + + config.vm.network :forwarded_port, guest: 5000, host: 8080 + config.vm.network :forwarded_port, guest: 22, host: 5522 + config.vm.network :forwarded_port, guest: 6543, host: 6543 + + # Forward x11 via ssh. + # Handy if you need to share a clipboard, convey viewport info, etc. + config.ssh.forward_x11 = true + + config.ssh.shell = "ash" + + $install_script = <<-SCRIPT + build_deps="go make dep" + runtime_deps="dumb-init bash" + + apk update && \ + apk add -u $build_deps $runtime_deps && \ + # adduser -D -H -h / -u $user_id tty-server && \ + cd /go/src/github.com/elisescu/tty-server && \ + GOPATH=/go dep ensure && \ + GOPATH=/go make all && \ + cp tty-server /usr/bin/ && \ + rm -r /go && \ + apk del $build_deps + SCRIPT + + config.vm.provision "file", source: ".", destination: "$HOME/go/src/github.com/elisescu/tty-server" + config.vm.provision "shell", inline: 'mv "/home/vagrant/go" "/go"' + config.vm.provision "shell", inline: $install_script + +end