Skip to content

Commit 86c5aff

Browse files
committed
Initial commit
0 parents  commit 86c5aff

3 files changed

Lines changed: 87 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
.vagrant

Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM ubuntu:12.04
2+
MAINTAINER Hongli Lai <hongli@phusion.nl>
3+
4+
## Fix some issues with APT packages.
5+
## See https://github.com/dotcloud/docker/issues/1024
6+
RUN dpkg-divert --local --rename --add /sbin/initctl
7+
RUN ln -s /bin/true /sbin/initctl
8+
9+
## Enable the following repositories:
10+
## - Ubuntu Universe
11+
## - Brightbox Ruby 1.9.3
12+
## - Phusion Passenger
13+
RUN echo deb http://archive.ubuntu.com/ubuntu precise main universe > /etc/apt/sources.list
14+
RUN echo deb http://archive.ubuntu.com/ubuntu precise-updates main universe >> /etc/apt/sources.list
15+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C3173AA6
16+
RUN echo deb http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu precise main > /etc/apt/sources.list.d/brightbox.list
17+
RUN apt-get update
18+
RUN apt-get install -y apt-transport-https
19+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
20+
RUN echo deb https://oss-binaries.phusionpassenger.com/apt/passenger precise main > /etc/apt/sources.list.d/passenger.list
21+
## Or, if you're using Phusion Passenger Enterprise:
22+
# RUN echo deb https://download:YOUR_DOWNLOAD_TOKEN@www.phusionpassenger.com/enterprise_apt precise main > /etc/apt/sources.list.d/passenger.list
23+
RUN apt-get update
24+
25+
## Install Ruby 1.9.3.
26+
RUN apt-get install -y ruby rake
27+
28+
## Install Nginx and Phusion Passenger.
29+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
30+
RUN echo deb https://oss-binaries.phusionpassenger.com/apt/passenger precise main > /etc/apt/sources.list.d/passenger.list
31+
RUN apt-get update
32+
RUN apt-get install -y rake nginx-extras passenger

Vagrantfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5+
VAGRANTFILE_API_VERSION = "2"
6+
7+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8+
config.vm.box = "precise64"
9+
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
10+
config.ssh.forward_agent = true
11+
12+
config.vm.provider :vmware_fusion do |f, override|
13+
override.vm.box_url = "http://files.vagrantup.com/precise64_vmware_fusion.box"
14+
f.vmx["displayName"] = "passenger-docker"
15+
# VMWare Tools is rendered unusable by the kernel upgrade,
16+
# and there's no easy way to automatically reinstall it,
17+
# so we use NFS instead of VMWare Shared Folders.
18+
config.vm.synced_folder ".", "/vagrant", :nfs => true
19+
end
20+
21+
# Provision docker and new kernel if deployment was not done.
22+
# It is assumed Vagrant can successfully launch the provider instance.
23+
if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty?
24+
# Add lxc-docker package
25+
pkg_cmd = "wget -q -O - https://get.docker.io/gpg | apt-key add -;" \
26+
"echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list;" \
27+
"apt-get update -qq; apt-get install -q -y --force-yes lxc-docker; "
28+
# Add Ubuntu raring backported kernel
29+
pkg_cmd << "apt-get update -qq; apt-get install -q -y linux-image-generic-lts-raring; "
30+
# Add guest additions if local vbox VM. As virtualbox is the default provider,
31+
# it is assumed it won't be explicitly stated.
32+
if ENV["VAGRANT_DEFAULT_PROVIDER"].nil? && ARGV.none? { |arg| arg.downcase.start_with?("--provider") }
33+
pkg_cmd << "apt-get install -q -y linux-headers-generic-lts-raring dkms; " \
34+
"echo 'Downloading VBox Guest Additions...'; " \
35+
"wget -q http://dlc.sun.com.edgesuite.net/virtualbox/4.2.12/VBoxGuestAdditions_4.2.12.iso; "
36+
# Prepare the VM to add guest additions after reboot
37+
pkg_cmd << "echo -e 'mount -o loop,ro /home/vagrant/VBoxGuestAdditions_4.2.12.iso /mnt\n" \
38+
"echo yes | /mnt/VBoxLinuxAdditions.run\numount /mnt\n" \
39+
"rm /root/guest_additions.sh; ' > /root/guest_additions.sh; " \
40+
"chmod 700 /root/guest_additions.sh; " \
41+
"sed -i -E 's#^exit 0#[ -x /root/guest_additions.sh ] \\&\\& /root/guest_additions.sh#' /etc/rc.local; " \
42+
"echo 'Installation of VBox Guest Additions is proceeding in the background.'; " \
43+
"echo '\"vagrant reload\" can be used in about 2 minutes to activate the new guest additions.'; "
44+
end
45+
# Add vagrant user to the docker group
46+
pkg_cmd << "usermod -a -G docker vagrant; "
47+
# Activate new kernel
48+
pkg_cmd << "shutdown -r +1; "
49+
pkg_cmd << "echo ---------- Kernel upgraded and Docker installed ----------; "
50+
pkg_cmd << "echo 'Please run \"vagrant reload\" in about 2 minutes to activate the new kernel and Docker.'"
51+
config.vm.provision :shell, :inline => pkg_cmd
52+
end
53+
end

0 commit comments

Comments
 (0)