Skip to content

Instantly share code, notes, and snippets.

@princebot
Created December 8, 2016 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save princebot/e3f9824861fa1343391b80c1e83a9ee4 to your computer and use it in GitHub Desktop.
Save princebot/e3f9824861fa1343391b80c1e83a9ee4 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Create Ubuntu 16 machine and do the following provision actions:
# - Update all packages.
# - Install git.
# - Install curl and wget.
# - Install apt-transport-https and ca-certificates.
# - Install linux headers.
# - Install custom dotfiles for users root and vagrant.
# - Install Miniconda 3 for users root and vagrant.
# - Install Docker.
# - Fetch repo for www.princebot.com server app.
# - Start Docker container serving www.princebot.com forwarded to port
# 8080 on the control host (i.e., the machine running Vagrant).
config.vm.define 'ubox' do |ubox|
ubox.vm.box = 'bento/ubuntu-16.04'
ubox.vm.hostname = 'ubox'
ubox.vm.network "forwarded_port", guest: 80, host: 8080
ubox.vm.provision "shell", inline: <<-EOF
apt-get -y update
apt-get -y install git curl wget vim apt-transport-https \
ca-certificates
apt-get -y upgrade
git clone https://github.com/princebot/dotfiles /tmp/dotfiles
wget -q -O /tmp/miniconda.sh \
https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod 0777 /tmp/miniconda.sh
for user in root vagrant; do
su -c "bash /tmp/dotfiles/installer/install" $user
su -c "bash /tmp/miniconda.sh -b" $user
done
rm -f -- /tmp/miniconda.sh
rm -rf -- /tmp/dotfiles
apt-key adv \
--keyserver hkp://ha.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" \
| tee /etc/apt/sources.list.d/docker.list
apt-get -y update
apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
apt-get install -y docker-engine
systemctl start docker
git clone https://github.com/princebot/www.princebot.com
cd www.princebot.com
docker build -t www.princebot.com .
docker run -d --name site --publish 80:8080 www.princebot.com serve
EOF
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment