Skip to content

Instantly share code, notes, and snippets.


dylan/Dockerfile Secret

Last active Nov 2, 2019
What would you like to do?
Sinatra Demo
FROM ubuntu
RUN apt-get install -y ruby rubygems git
RUN git clone /opt/sinatra/
RUN gem install bundler
EXPOSE :5000
RUN cd /opt/sinatra && bundle install
CMD ["/usr/local/bin/foreman","start","-d","/opt/sinatra"]
source ''
gem 'sinatra'
gem 'foreman'
web: bundle exec ruby server.rb
require 'sinatra'
#Bound to this address so that external hosts can access it, VERY IMPORTANT!
set :bind, ''
set :logging, true
get '/' do
'hello world'
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'json' do |config| = "raring"
config.vm.box_url = ""
config.vm.forward_port 5000, 5000
config.vm.customize [
"modifyvm", :id,
"--memory", 512
# Check if a vm has been provisioned yet
if File.exists?".vagrant"
vagrant_file = JSON.load('.vagrant'))
if vagrant_file.nil? or !vagrant_file['active'].has_key?('default')
# I broke out each command here so we can see exactly what occurs
# We're gonna use this a few times
apt_update = "apt-get update;"
# Shortcut in case we need it
restart = "shutdown -r +1;"
# Install aufs
aufs_supp = "apt-get install linux-image-extra-`uname -r` dkms -y;"
# Add the repo key so we can grab 0.6
add_docker_repo_key = "sudo sh -c \"curl | apt-key add -\";"
# Add the repo for the Docker packages
add_docker_repo = "sudo sh -c \"echo deb docker main > /etc/apt/sources.list.d/docker.list\";"
# Install Docker
install_docker = "apt-get install -q -y --force-yes lxc-docker;"
# Put it all together,
icmd = "#{apt_update} "\
"#{aufs_supp} "\
"#{add_docker_repo} "\
"#{apt_update} "\
# And run it.
config.vm.provision :shell, :inline => icmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment