mirror of
/repos/baseimage-docker.git
synced 2025-12-30 08:01:31 +01:00
* All synced_folders are included. * Vagrantfile of baseimage and passenger are nearly identical now. (I got to that when wanting to try passenger. But already had a vagrant box started from baseimage, there was no need to dup the effort, just reuse the existing single box for all. Then in end of day, may not need multiple Vagrantfiles. Passenger is a simple structure/process for managing dockers, but only needing to use baseimage once and have one VM up)
55 lines
2.3 KiB
Ruby
55 lines
2.3 KiB
Ruby
# -*- mode: ruby -*-
|
|
# vi: set ft=ruby :
|
|
ROOT = File.dirname(File.expand_path(__FILE__))
|
|
|
|
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
|
VAGRANTFILE_API_VERSION = '2'
|
|
|
|
# Default env properties which can be overridden
|
|
# Example overrides:
|
|
# echo "ENV['PASSENGER_PATH_URI' ] ||= '../../phusion/passenger-docker' " >> ~/.vagrant.d/Vagrantfile
|
|
# echo "ENV['BASE_BOX_URL'] ||= 'd\:/dev/vm/vagrant/boxes/phusion/'" >> ~/.vagrant.d/Vagrantfile
|
|
BASE_BOX_URL = ENV['BASE_BOX_URL' ] || 'https://oss-binaries.phusionpassenger.com/vagrant/boxes/'
|
|
VAGRANT_BOX_URL = ENV['VAGRANT_BOX_URL' ] || BASE_BOX_URL + 'ubuntu-12.04.3-amd64-vbox.box'
|
|
VMWARE_BOX_URL = ENV['VMWARE_BOX_URL' ] || BASE_BOX_URL + 'ubuntu-12.04.3-amd64-vmwarefusion.box'
|
|
BASEIMAGE_PATH_URI = ENV['BASEIMAGE_PATH_URI' ] || '../baseimage-docker'
|
|
PASSENGER_PATH_URI = ENV['PASSENGER_PATH_URI' ] || '../passenger-docker'
|
|
DOCKERIZER_PATH_URI = ENV['DOCKERIZER_PATH_URI'] || '../dockerizer'
|
|
|
|
$script = <<SCRIPT
|
|
wget -q -O - https://get.docker.io/gpg | apt-key add -
|
|
echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
|
|
apt-get update -qq
|
|
apt-get install -q -y --force-yes lxc-docker
|
|
usermod -a -G docker vagrant
|
|
docker version
|
|
su - vagrant -c 'echo alias d=docker >> ~/.bash_aliases'
|
|
SCRIPT
|
|
|
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
config.vm.box = 'phusion-open-ubuntu-12.04-amd64'
|
|
config.vm.box_url = VAGRANT_BOX_URL
|
|
config.ssh.forward_agent = true
|
|
passenger_path = "#{ROOT}/#{PASSENGER_PATH_URI}"
|
|
if File.directory?(passenger_path)
|
|
config.vm.synced_folder File.expand_path(passenger_path), '/vagrant/passenger-docker'
|
|
end
|
|
baseimage_path = "#{ROOT}/#{BASEIMAGE_PATH_URI}"
|
|
if File.directory?(baseimage_path)
|
|
config.vm.synced_folder File.expand_path(baseimage_path), '/vagrant/baseimage-docker'
|
|
end
|
|
dockerizer_path = "#{ROOT}/#{DOCKERIZER_PATH_URI}"
|
|
if File.directory?(dockerizer_path)
|
|
config.vm.synced_folder File.expand_path(dockerizer_path), '/vagrant/dockerizer'
|
|
end
|
|
|
|
config.vm.provider :vmware_fusion do |f, override|
|
|
override.vm.box_url = VMWARE_BOX_URL
|
|
f.vmx['displayName'] = 'baseimage-docker'
|
|
end
|
|
|
|
if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty?
|
|
config.vm.provision :shell, :inline => $script
|
|
end
|
|
end
|