#!/bin/bash -ex

apt-get update
apt-get install -y wget build-essential autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev

cd /tmp
rm -rf ruby-installer
mkdir ruby-installer
cd ruby-installer
echo "fetch latest ruby from ftp.ruby-lang.org"
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
tar -xzvf ruby-2.1.2.tar.gz
echo "installing ruby 2.1.2"
cd ruby-2.1.2/ && ./configure && make && make install
echo "installed ruby interpreter, version:"
echo `ruby -v`
gem install bundler --no-ri --no-rdoc
echo "installed bundler"

apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

#!/bin/bash -ex

apt-get update
apt-get install -y wget

cd /tmp
rm -rf ruby-installer
mkdir ruby-installer
cd ruby-installer
echo "fetch latest ruby from ftp.ruby-lang.org"
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
tar -xzvf ruby-2.1.2.tar.gz
echo "installing ruby 2.1.2"
cd ruby-2.1.2/ && ./configure && make && make install
echo "installed ruby interpreter, version:"
echo `ruby -v`
gem install bundler --no-ri --no-rdoc
echo "installed bundler"
rm -rf /tmp/ruby-installer

--- 
+++ 
@@ -1,7 +1,7 @@
 #!/bin/bash -ex
 
 apt-get update
-apt-get install -y wget build-essential autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev
+apt-get install -y wget
 
 cd /tmp
 rm -rf ruby-installer
@@ -16,6 +16,4 @@
 echo `ruby -v`
 gem install bundler --no-ri --no-rdoc
 echo "installed bundler"
-
-apt-get clean
-rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
+rm -rf /tmp/ruby-installer
Make the ruby file completely self contained