2
0
mirror of https://github.com/elisescu/tty-server synced 2024-11-15 12:12:54 +00:00

Remove vagrantfile for clean feature branch

This commit is contained in:
Matthew Strasiotto 2020-09-17 12:11:44 +00:00
parent 51f189421b
commit c86e17f9ed

View File

@ -1,50 +0,0 @@
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 && \
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
$serve_script = <<-'SCRIPT'
cat << EOD | sed -e "s#\\\\{#{#g; s#\\\\}#}#g" > /usr/bin/serve
#!/usr/bin/env bash
URL="$\\{1:-http://localhost:5000\\}"
/usr/bin/tty-server -web_address :5000 --sender_address :6543 -url "$\\{URL\\}"
EOD
chmod a+x /usr/bin/serve
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"', name: "move_go"
config.vm.provision "shell", inline: $install_script, name: "install"
config.vm.provision "shell", inline: $serve_script, name: "serve"
end