Skip to content

Instantly share code, notes, and snippets.

@yohfee
Last active July 15, 2021 23:43
Show Gist options
  • Select an option

  • Save yohfee/6a897b7008f87c1b4850 to your computer and use it in GitHub Desktop.

Select an option

Save yohfee/6a897b7008f87c1b4850 to your computer and use it in GitHub Desktop.
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 3000, host: 3000
config.vm.network "private_network", ip: "192.168.33.20"
config.vm.synced_folder ".", "/app", nfs: true
config.ssh.forward_agent = true
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
config.vm.provision "shell", inline: <<-SHELL
locale-gen ja_JP.UTF-8
update-locale LANG=ja_JP.UTF-8
apt-get update -y
apt-get upgrade -y
apt-get install -y \
git curl nodejs \
autoconf bison build-essential \
libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev \
postgresql libpq-dev
sudo -u postgres createuser -d vagrant
SHELL
config.vm.provision "shell", privileged: false, inline: <<-SHELL
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
echo 'eval "$(rbenv init -)"' >> ~/.profile
echo 'export PATH=".bundle/bin:$PATH"' >> ~/.profile
source ~/.profile
rbenv install 2.2.0
rbenv rehash
rbenv shell 2.2.0
gem i bundler --no-ri --no-rdoc
rbenv rehash
cd /app
rbenv local 2.2.0
bundle --binstubs .bundle/bin --path .bundle/bundle --without production
rake db:create db:migrate
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment