Skip to content

Instantly share code, notes, and snippets.

@jokeyrhyme
Last active August 29, 2015 14:03
Show Gist options
  • Save jokeyrhyme/0341837e20dc9b5b8a58 to your computer and use it in GitHub Desktop.
Save jokeyrhyme/0341837e20dc9b5b8a58 to your computer and use it in GitHub Desktop.
Docker and Vagrant

GitHub Pages blog

  • put Vagrantfile in ~/Projects
  • put Dockerfile in ~/Projects/blog
cd ~/Projects
vagrant reload
vagrant provision
vagrant ssh

cd /vagrant/blog
docker build .
docker run -p 4000:4000 -v /vagrant/blog:/app -i <ID>
FROM ubuntu:14.04
MAINTAINER Ron Waldon <[email protected]>
RUN apt-get -y update
RUN apt-get -y install build-essential ruby2.0 ruby2.0-dev libxml2-dev libxslt-dev
WORKDIR /usr/bin
RUN ln -sf ruby2.0 ruby
RUN ln -sf gem2.0 gem
RUN gem install bundler
VOLUME ['/app']
WORKDIR /app
EXPOSE 4000
CMD bundle update && bundle exec jekyll serve --watch --drafts --baseurl ''
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
$script = <<SCRIPT
yum install -y docker-io
systemctl daemon-reload
systemctl start docker
systemctl enable docker
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/fedora-20"
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "forwarded_port", guest: 443, host: 8443
config.vm.network "forwarded_port", guest: 4000, host: 4000
config.vm.network "private_network", type: "dhcp"
# config.ssh.forward_agent = true
# this synced_folder is the default, but let's be explicit
config.vm.synced_folder ".", "/vagrant"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--ioapic", "on"]
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--cpus", "3"]
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "80"]
end
config.vm.provision "shell", inline: $script
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment