Minimalist Docker image for Ruby based on Alpine linux.
$ docker run -it coopermaa/alpine-ruby
This will drop you an interactive Ruby shell.
$ docker run --rm coopermaa/alpine-ruby -e 'puts "Hello World"'
You will get printed "Hello World" from Ruby.
You can run a Ruby script by using the Ruby Docker image directly:
$ docker run --rm -v "$PWD":/app coopermaa/alpine-ruby ruby /app/your-daemon-or-script.rb
Create a Dockerfile in your Ruby app project
FROM coopermaa/alpine-ruby:2.2-onbuild]
CMD ["./your-daemon-or-script.rb"]
Put this file in the root of your app, next to the Gemfile.
This image includes multiple ONBUILD triggers which should be all you need to bootstrap most applications.
The build will COPY . /usr/src/app and RUN bundle install.
You can then build and run the Ruby image:
$ docker build -t my-ruby-app .
$ docker run -it --name my-running-script my-ruby-app
A note about Dockerfile
The package
ruby-devdepends onruby,ruby-irb,ruby-rake,ruby-io-console,ruby-minitest,ruby-json,ruby-libs... Theapkpackage manager will install all of them. Runapk info -a ruby-devinside a container for more information.Add the package
build-baseif you want to build gem native extesion (It will increase about 120MB to the image). The packagebuild-baseis similar package tobuild-essential.
Content type
Image
Digest
sha256:af20e175b…
Size
10.1 MB
Last updated
about 11 years ago
docker pull coopermaa/alpine-ruby