├── Dockerfile.yml ├── README.md ├── LICENSE ├── Dockerfile ├── postmodern.asc └── Dockerfile.erb /Dockerfile.yml: -------------------------------------------------------------------------------- 1 | ruby_version: 2.2.3 2 | ruby_install_version: 0.5.0 3 | ruby_gems: 4 | - bundler 5 | apt_packages: 6 | - bison 7 | - flex 8 | - libxml2-dev 9 | - libxslt1-dev 10 | - libssl-dev 11 | - libreadline-dev 12 | - zlib1g-dev 13 | configure_options: 14 | - --disable-install-doc 15 | 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # janlelis/ruby-only 2 | 3 | An ubuntu based docker image that installs the latest Ruby via [ruby-install](https://github.com/postmodern/ruby-install). 4 | 5 | ## Version Strategy 6 | 7 | You can specify a Ruby version using it as a docker tag. It will lead to the respective branch on this repo. The branches will be updated, when the Dockerfile structure is changed. If you want to ensure that you will always get the very same Dockerfile, add "-fixed" to your docker tag, which will lead to git tags in this repo. 8 | 9 | ## Usage 10 | 11 | This is an example Dockerfile you could use for running an IRB process: 12 | 13 | FROM janlelis/ruby-only 14 | CMD ["irb"] 15 | 16 | You can build it with: 17 | 18 | docker build -t irb-image . 19 | 20 | And then run it with: 21 | 22 | docker run -it irb-image 23 | 24 | ## MIT-License 25 | 26 | Originally based on the [Ruby Dockerfile by Abe Voelker](https://github.com/abevoelker/docker-ruby). 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2014 Abe Voelker 2 | With Portions Copyright 2014 Jan Lelis 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # # # 2 | # Base Dockerfile for Ruby applications 3 | # # # 4 | 5 | FROM ubuntu:trusty 6 | MAINTAINER Jan Lelis 7 | ENV DEBIAN_FRONTEND noninteractive 8 | 9 | # Ensure locale 10 | RUN apt-get -y update 11 | RUN dpkg-reconfigure locales && \ 12 | locale-gen en_US.UTF-8 && \ 13 | /usr/sbin/update-locale LANG=en_US.UTF-8 14 | ENV LC_ALL en_US.UTF-8 15 | 16 | # Essential packages 17 | RUN apt-get -y update 18 | RUN apt-get -y install wget build-essential git 19 | 20 | # Ruby dependencies 21 | RUN apt-get -y install bison flex libreadline-dev libssl-dev libxml2-dev libxslt1-dev zlib1g-dev 22 | 23 | # Get ruby-install source 24 | WORKDIR /tmp 25 | RUN wget -O ruby-install-0.5.0.tar.gz \ 26 | https://github.com/postmodern/ruby-install/archive/v0.5.0.tar.gz 27 | RUN wget https://raw.github.com/postmodern/ruby-install/master/pkg/ruby-install-0.5.0.tar.gz.asc 28 | 29 | # Verify it is ruby-install 30 | ADD ./postmodern.asc /tmp/postmodern.asc 31 | RUN gpg --no-default-keyring --import postmodern.asc 32 | RUN gpg --verify ruby-install-0.5.0.tar.gz.asc \ 33 | ruby-install-0.5.0.tar.gz 34 | 35 | # Install ruby-install 36 | RUN tar -xzvf ruby-install-0.5.0.tar.gz 37 | WORKDIR ruby-install-0.5.0/ 38 | RUN make install 39 | 40 | # Install actual Ruby 41 | RUN ruby-install ruby 2.2.3 -- --disable-install-doc 42 | 43 | # Add Ruby binaries to $PATH 44 | ENV PATH $PATH:/opt/rubies/ruby-2.2.3/bin 45 | RUN echo 'export PATH="$PATH:/opt/rubies/ruby-2.2.3/bin"' > /etc/profile.d/ruby.sh 46 | RUN chmod a+x /etc/profile.d/ruby.sh 47 | RUN echo '\nsource /etc/profile.d/ruby.sh' >> /etc/bash.bashrc 48 | 49 | # Adjust user gem settings 50 | RUN echo 'if (( $UID != 0 )); then\n\texport GEM_HOME="$HOME/.gems/2.2.3"\n\texport PATH="$PATH:$GEM_HOME/bin"\nfi' >> /etc/profile.d/ruby.sh 51 | 52 | # Never install Ruby docs 53 | RUN mkdir /opt/rubies/ruby-2.2.3/etc 54 | RUN echo "gem: --no-document" > /opt/rubies/ruby-2.2.3/etc/gemrc 55 | 56 | # Install global gems 57 | RUN /bin/bash -l -c 'gem install bundler' 58 | 59 | # Cleaning... 60 | WORKDIR / 61 | RUN apt-get clean 62 | RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 63 | 64 | -------------------------------------------------------------------------------- /postmodern.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: GnuPG v2.0.18 (GNU/Linux) 3 | 4 | mQGiBEq0G60RBAD+JBpmbMAyBjCrotEYN2wJmtPjlLLIbmspmQXYKs7JRVBKyJWY 5 | GDAXUOcSDPSJh14a7W6CL5NYxBTfUZkd2wBEepk/1zXKuWSGk5ug/jFjZdnvpzfz 6 | m/xWYZvUDE3G5j1fui49s2AwLsUXYQNf7IhpM9TB0OQLFgjxe0/m4WA9vwCgmT/4 7 | +lkjTo9OT/3ZXSgzPTLJ8KkD/A51BHo6ENMSOO5zZGKmnIj9GAgEZ6H+lzMyzUUd 8 | cPYNxHnpdbrKn78oFNKJ6mavCxoW9A8MPbMlb/+A9iqHPkNhimXWypKmrohepoEH 9 | s3K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dMzcw2WDHWr9747GR 25 | NMWw1ZSeTFDPcpK5XTG0p61fiEoGXVavxxyTDer7xokJbJPbtx4EvimDDM90GJ4i 26 | hRhZzV/Y/PRD51pm52HNEWA3I5VgfO0KuPlr8MmGTzt3FeJEzDsZ+9F82qsrKvXM 27 | bsGfAAMFD/4rEdCpF6al4B/BdhR/WLzf68AkAZDv7rxFWonTg8JLs7geGtg5oFLY 28 | UInj0pOVMC7CpyLmDG1Kc9gSOoVqBRCkI8ffoNwXsD4HBS/1GUoXoaF4spxUcqxQ 29 | Ygdfrfo97IoE7rlH1vTGyYWSMTq8Ku3/JzyI4lpy0J176J29+bjarY1sum0D6sUH 30 | 9NvrZiWRlB2RroSZtfYj2btl/ClXC3NVswbstgr21u9C7OVvZIN7obZCJI/Jb1ah 31 | 2Tg3wpTU4mEzdAzyojtp3fZhV/oihh0lO+fz5DbCHE6M6i4yRHpO3Wkw2KPWVDJX 32 | WsTQ6NcVo+3ASkmS/YAJNVeH+wt/SwC9QVG0C6SepAw4l6XrxQvPoOihDhOIJtUs 33 | 98dgRufivclaMKk/0sYEEqLtkGkEr81ElGFx7Wj152BVEKMlZYQwA8xaPOxUMivI 34 | a5QJ6XIWFZaPm4pVVW/XoBVxNRhsIn+MDGOkN7GFOjQHO+fiZ7iScLYGCTe5hbfW 35 | 0aumW0Ygq2rk4de6RgV/E8cPQVQdkGNLt14i93qwETj41AwsiTidmCvG9pLCgQCy 36 | PvYy05O3dXvX7otCRcdhyRHNM2Ke2elhOYCc9L0cYbQ5U8wT0Ai2/qfRvCIsyilZ 37 | /PmNpcW+Wo/GSHqdB1XCFsaOcntpJboWkbjpV1WkC/81UPwfzzxW5YhJBBgRAgAJ 38 | BQJKtButAhsMAAoJEFTD2em5UV53FpcAn0H2eb4jcwdmgh99mFBj/3qnVNdDAJ9A 39 | MFo8HeCQjtomEIjERvZc5Z4NXg== 40 | =cNML 41 | -----END PGP PUBLIC KEY BLOCK----- 42 | -------------------------------------------------------------------------------- /Dockerfile.erb: -------------------------------------------------------------------------------- 1 | # # # 2 | # Base Dockerfile for Ruby applications 3 | # # # 4 | 5 | FROM ubuntu:trusty 6 | MAINTAINER Jan Lelis 7 | ENV DEBIAN_FRONTEND noninteractive 8 | 9 | # Ensure locale 10 | RUN apt-get -y update 11 | RUN dpkg-reconfigure locales && \ 12 | locale-gen en_US.UTF-8 && \ 13 | /usr/sbin/update-locale LANG=en_US.UTF-8 14 | ENV LC_ALL en_US.UTF-8 15 | 16 | # Essential packages 17 | RUN apt-get -y update 18 | RUN apt-get -y install wget build-essential git 19 | 20 | # Ruby dependencies 21 | % if defined? apt_packages 22 | RUN apt-get -y install <%= apt_packages.sort.join " " %> 23 | % end 24 | 25 | # Get ruby-install source 26 | WORKDIR /tmp 27 | RUN wget -O ruby-install-<%= ruby_install_version %>.tar.gz \ 28 | https://github.com/postmodern/ruby-install/archive/v<%= ruby_install_version %>.tar.gz 29 | RUN wget https://raw.github.com/postmodern/ruby-install/master/pkg/ruby-install-<%= ruby_install_version %>.tar.gz.asc 30 | 31 | # Verify it is ruby-install 32 | ADD ./postmodern.asc /tmp/postmodern.asc 33 | RUN gpg --no-default-keyring --import postmodern.asc 34 | RUN gpg --verify ruby-install-<%= ruby_install_version %>.tar.gz.asc \ 35 | ruby-install-<%= ruby_install_version %>.tar.gz 36 | 37 | # Install ruby-install 38 | RUN tar -xzvf ruby-install-<%= ruby_install_version %>.tar.gz 39 | WORKDIR ruby-install-<%= ruby_install_version %>/ 40 | RUN make install 41 | 42 | # Install actual Ruby 43 | % if defined? configure_options 44 | % normalized_configure_options = " -- " + configure_options.sort.join(" ") 45 | % else 46 | % normalized_configure_options = nil 47 | % end 48 | RUN ruby-install ruby <%= ruby_version %><%= normalized_configure_options %> 49 | 50 | # Add Ruby binaries to $PATH 51 | % ruby_base_path = "/opt/rubies/ruby-#{ruby_version}" 52 | ENV PATH $PATH:<%= ruby_base_path %>/bin 53 | RUN echo 'export PATH="$PATH:<%= ruby_base_path %>/bin"' > /etc/profile.d/ruby.sh 54 | RUN chmod a+x /etc/profile.d/ruby.sh 55 | RUN echo '\nsource /etc/profile.d/ruby.sh' >> /etc/bash.bashrc 56 | 57 | # Adjust user gem settings 58 | RUN echo 'if (( $UID != 0 )); then\n\texport GEM_HOME="$HOME/.gems/<%= ruby_version %>"\n\texport PATH="$PATH:$GEM_HOME/bin"\nfi' >> /etc/profile.d/ruby.sh 59 | 60 | # Never install Ruby docs 61 | RUN mkdir <%= ruby_base_path %>/etc 62 | RUN echo "gem: --no-document" > <%= ruby_base_path %>/etc/gemrc 63 | 64 | # Install global gems 65 | % if defined? ruby_gems 66 | RUN /bin/bash -l -c 'gem install <%= ruby_gems.sort.join " " %>' 67 | % end 68 | 69 | # Cleaning... 70 | WORKDIR / 71 | RUN apt-get clean 72 | RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 73 | 74 | --------------------------------------------------------------------------------